I have some code that takes a password and turns it into a key. I'd like the be able to take the key and turn it back into a password. The following code is what I have to produce the key from a string. I'm not really sure how to do the opposite of this. Any ideas? BTW - The key I have is -1160584442L.
Thanks!

long key = 0xA8B0850F;
keyptr = (char *) &key;

while (*pwstring != '\0')
{
keyptr [index] ^= *pwstring++;

if (++index == sizeof (long))
index = 0;
}