Skip to content

Instantly share code, notes, and snippets.

@bayotop
Created August 22, 2017 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bayotop/657097a72ca9a1fe2f3307d6e06fa008 to your computer and use it in GitHub Desktop.
Save bayotop/657097a72ca9a1fe2f3307d6e06fa008 to your computer and use it in GitHub Desktop.
Unsafe default behavior of Encoding.UTF8.GetBytes()
string secret = "\ud8ab";
string secret2 = "\ud8cd";
if (!secret.Equals(secret2))
{
Console.Out.WriteLine("The strings are not equal.");
}
computeSignature(secret, "timestamp", "payload"); // returns 1eba7aac5f10ee7aa985722256aa4125e8e59fe256386c8ab10295063d986e57
computeSignature(secret2, "timestamp", "payload"); // returns 1eba7aac5f10ee7aa985722256aa4125e8e59fe256386c8ab10295063d986e57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment