public static BigInteger mpz_shash( String input) { /* hash the input */ String digest = h(input); /* convert the digest to a hexadecimal encoded string */ String hex_digest = ToolsString.ConvertToStringHex(digest); /* convert the hexadecimal encoded string to an mpz-integer */ return(BigInteger.Parse(hex_digest, System.Globalization.NumberStyles.HexNumber)); }
/* * Hashing of the public inputs (aka Fiat-Shamir heuristic) with h(), * e.g. to make some proofs of knowledge non-interactive. */ public static BigInteger mpz_shash( BigInteger [] array) { String acc = ""; /* concatenate all the arguments */ for (int i = 0; i < array.Length; i++) { acc += ToolsString.ConvertToStringHex(array[i].ToString()) + "|"; } /* hash arguments */ return(mpz_shash(acc)); }
public static BigInteger mpz_shash( BigInteger value) { return(mpz_shash(ToolsString.ConvertToStringHex(value.ToString()) + "|")); }