private static string ToChecksumAddress(string hex) { byte[] bytes = Encoding.ASCII.GetBytes(hex); byte[] hash = CalculateHash(bytes); string hashHex = ByteUtil.Hex(hash); string address = string.Empty; for (var i = 0; i < hex.Length; i++) { char c = hex[i]; address += (hashHex[i] >= '8') ? char.ToUpper(c, CultureInfo.InvariantCulture) : c; } return(address); }
public string ToHex() { string hex = ByteUtil.Hex(ToByteArray()); byte[] bytes = Encoding.ASCII.GetBytes(hex); byte[] hash = CalculateHash(bytes); string hashHex = ByteUtil.Hex(hash); string address = string.Empty; for (var i = 0; i < hex.Length; i++) { char c = hex[i]; address += (hashHex[i] >= '8') ? char.ToUpper(c) : c; } return(address); }
public override string ToString() { return(ByteUtil.Hex(ToByteArray())); }
public string ToHex() { string hex = ByteUtil.Hex(ToByteArray()); return(ToChecksumAddress(hex)); }
public string ToHex() { return(ByteUtil.Hex(ToByteArray())); }