Пример #1
0
    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));
    }
Пример #2
0
    /*
     * 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));
    }
Пример #3
0
 public static BigInteger mpz_shash(
     BigInteger value)
 {
     return(mpz_shash(ToolsString.ConvertToStringHex(value.ToString()) + "|"));
 }