Created
September 23, 2025 20:28
-
-
Save ProbablePrime/3e45739ef10b178ef572998c3cce12fc to your computer and use it in GitHub Desktop.
A Microsoft.Extensions.Compliance.Redaction that redacts secrets replacing them with "CHEESE"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Extensions.Compliance.Redaction; | |
| using System; | |
| namespace Cheese; | |
| public class CheeseRedactor : Redactor | |
| { | |
| private const string CHEESE = nameof(CHEESE); | |
| public override int GetRedactedLength(ReadOnlySpan<char> input) => input.Length; | |
| public override int Redact(ReadOnlySpan<char> source, Span<char> destination) | |
| { | |
| for (int i = 0; i < destination.Length; i++) | |
| { | |
| destination[i] = CHEESE[i % CHEESE.Length]; | |
| } | |
| return destination.Length; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment