Bug 178796: change the way we generate the new salt so that we are cross-plat.

This commit is contained in:
Jim Norman 2006-05-25 22:18:58 +00:00
parent 6a642cfabb
commit 119e217e4b
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,8 @@
--------------------------------------------------------------------
Thursday May 25 16:15:53 MST 2006 - jnorman@novell.com
- Bug 178796: change the way we generate the new salt so that
we are cross-plat.
--------------------------------------------------------------------
Thursday May 25 09:21:53 MST 2006 - cmashayekhi@novell.com
- casa-gnome-keyring.h was cleaned up.

View File

@ -144,10 +144,12 @@ namespace sscs.crypto {
// iterate thru each character, creating a new Random,
// getting 2 bytes from each, until our salt buffer is full.
for (int i = 0; i < password.Length; i++)
for (int i = 0; i < password.Length;)
{
FastRandom ranNum = new FastRandom((password[i].ToString().GetHashCode()) * (j+1));
char letter = password[i];
int iLetter = (int)letter;
FastRandom ranNum = new FastRandom(iLetter * (j+1));
byte[] temp = new byte[2];
ranNum.NextBytes(temp);
@ -161,11 +163,15 @@ namespace sscs.crypto {
}
}
i++;
// reset i if at end of password
if ((i + 1) == password.Length)
if ((i + 1) > password.Length)
{
i = 0;
}
}
return buffer;