Last post Dec 03, 2010 09:46 AM by ebrinkman
Dec 02, 2010 05:50 PM|ebrinkman|LINK
I am using different calls to the same crypto provider that return different hashes. I need to have the same hashes in order for my program to work. Below is the code I am executing. I am open to any suggesions.
mystring = EncryptData(User.Identity.Name.Substring(4));
mystring2 = EncryptData(User.Identity.Name.Substring(4));
areEqual = mystring.SequenceEqual(mystring2);
byte mystring;byte mystring2;bool
byte EncryptData(string myInput)
byte valueToHash =
return generatedHash =
Dec 03, 2010 09:46 AM|ebrinkman|LINK
I solved the problem by not using the cryptography block at all. Below is the code I used. The hash value is now the same on multiple hash calls for the same string.
string verifiableMesage = "It was the best of times, it was the worst of times. ";
SHA1Managed sha = new SHA1Managed() ;
byte hashValue =
sha. ComputeHash(System. Text.ASCIIEncoding. ASCII. GetBytes(verifiableMesage) ) ;