salt - Check HMAC-SHA1 without key in C# -


i generating hmac-sha1 without key in c# , returns every time different hash same value, how can match hashes,

my code https://dotnetfiddle.net/3a3tip

  • is possible or not match these hashes?
  • i think hmac-sha1 not possible without key right?
  • if above 'yes' why c# allow generate without key , how doing?

yes, because using parameterless constructor build hmacsha1 instance, , msdn says

hmacsha1() - initializes new instance of hmacsha1 class randomly generated key.

just add constant key , you'll same hash every time. e.g.

var hmacsha = new hmacsha1(encoding.utf8.getbytes("yourconstantkey")); 

and answering questions:

  1. yes, use same key 2 generations.
  2. yes.
  3. it generates random key you

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -