internal static byte[] GenerateMac(byte[] derivedKey, byte[] cipherText) { var result = new byte[16 + cipherText.Length]; Array.Copy(derivedKey, 16, result, 0, 16); Array.Copy(cipherText, 0, result, 16, cipherText.Length); return(SHA3.Hash256(result)); }
public static string ToEIP55(string address) { bool prefix = address.HasHexPrefix(); string addr = address.ToLower().RemoveHexPrefix(); string hash = SHA3.Hash256(addr).ToHex(); string eip55 = ""; for (int i = 0; i < addr.Length; i++) { string c = hash[i].ToString(); eip55 += Convert.ToByte(hash[i].ToString(), 16) >= 8 ? addr[i].ToString().ToUpper() : addr[i].ToString(); } return((prefix ? HexExtension.HexPrefix : "") + eip55); }