| re: .NET hash/Cryptography newby question
"johnnyG" <johnnyG@discussions.microsoft.com> wrote in message
news:704A49CE-898D-4E01-9648-6E8C047E1316@microsoft.com...[color=blue]
> Greetings,
> I'm studying for the 70-330 Exam using the MS Press book by Tony Northrup
> and there are 2 side-by-side examples of using the
> SHA1CryptoServiceProvider
> to create a hash value from a string.
> The vb example outputs "A94A8FE5CCB19BA61C4C0873D391E987982FBBD3"
> The cs example outputs "5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8"
> for the string "password"
> Question: do the 2 applications use different automatic "salts" or "seeds"
> to generate the hash? More specifically, why are they different? Is there
> no
> single SHA1 hash for the string "password"?
> I know these are newby questions, but I'm having diffculty getting my head
> around what exactly is going on with the hash process...[/color]
This is very strange...
I recreated the program in Chrome for .net 2.0:
class method ConsoleApp.Main;
begin
var myHash := new System.Security.Cryptography.SHA1CryptoServiceProv ider;
var password := System.Text.Encoding.ASCII.GetBytes('password');
myHash.ComputeHash(password);
for thisByte: Byte in myHash.Hash do
begin
Console.Write(thisByte.ToString('X2'));
end;
Console.WriteLine;
end;
this is the result:
5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
The same as the C# program...
I wonder why the VB.net app is outputting an other hashcode...
Regards,
Jeroen Vandezande |