Skip to content

Commit

Permalink
fix: ToUpper
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Sep 11, 2022
1 parent 57d396d commit de750e9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GZCTF/Utils/Codec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public static double LeetEntropy(string flag)
doLeet = true;
else if (doLeet && (c == '}' || c == '['))
doLeet = false;
else if (doLeet && CharMap.TryGetValue(char.ToUpper(c), out string? table) && table is not null)
else if (doLeet && CharMap.TryGetValue(char.ToUpperInvariant(c), out string? table) && table is not null)
entropy += Math.Log(table.Length, 2);
}
return entropy;
Expand All @@ -116,7 +116,7 @@ public static string LeetFlag(string original)
doLeet = true;
else if (doLeet && (c == '}' || c == '['))
doLeet = false;
else if (doLeet && CharMap.TryGetValue(char.ToUpper(c), out string? table) && table is not null)
else if (doLeet && CharMap.TryGetValue(char.ToUpperInvariant(c), out string? table) && table is not null)
{
var nc = table.ElementAt(random.Next(table.Length));
sb.Append(nc);
Expand Down

0 comments on commit de750e9

Please sign in to comment.