Possible Duplicate:
C# SHA-1 vs. PHP SHA-1…Different Results?
I am trying to find out what the PHP sha1(string,true);
equivalent method is in C#. I tried searching a lot and also tried writing some code, but couldn't find any solution. Can anyone tell me how to get sha1
in row binary format with a length of 20, like the PHP function: SHA1 in the PHP manual?
In PHP:
sha1($sampletext, true);
In C#:
string sampletext= "text";
SHA1 hash = SHA1CryptoServiceProvider.Create();
byte[] plainTextBytes = Encoding.ASCII.GetBytes(dataString);
byte[] hashBytes = hash.ComputeHash(plainTextBytes);
Both return a different output.
Thanks