// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; public class MySQL { public static void HashPassword(uint[] result, string password) { uint nr = 1345345333; uint add = 7; uint nr2 = 0x12345671; for(int i = 0; i < password.Length; i++) { if(password[i]==' ' || password[i]=='\t') continue; uint tmp = (uint)password[i]; nr ^= (((nr & 63) + add)*tmp) + (nr << 8); nr2 += (nr2 << 8) ^ nr; add += tmp; } result[0] = nr & (((uint) 1 << 31) - 1); result[1] = nr2 & (((uint) 1 << 31) - 1); } } class MainClass { public static void Main(string[] args) { uint[] hash = new uint[2]; MySQL.HashPassword(hash, "hemmeligt"); Console.WriteLine(hash[0] + " " + hash[1]); } }