public static uint[] encrypt_key(Sjcl.Cipher.Aes cipher, uint[] a) { if (a.Length == 4) return cipher.Encrypt(a); List<uint> x = new List<uint>(); for (var i = 0; i < a.Length; i += 4) x.AddRange(cipher.Encrypt(new uint[] { a[i], a[i + 1], a[i + 2], a[i + 3] })); return x.ToArray(); }
public static string stringhash(string s, Sjcl.Cipher.Aes aes) { var s32 = str_to_a32(s); var h32 = new uint[] { 0, 0, 0, 0 }; for (int i = 0; i < s32.Length; i++) { h32[i & 3] ^= s32[i]; } for (int i = 16384; (i--) != 0; ) { h32 = aes.Encrypt(h32); } return a32_to_base64(new uint[] { h32[0], h32[2] }); }