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:
- yes, use same key 2 generations.
- yes.
- it generates random key you
Comments
Post a Comment