Assets/Scripts/BIP39/Utilities.cs
/// <summary>
/// Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is
/// standard procedure in BitCoin. The resulting hash is in big endian form.
/// </summary>
Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is
standard procedure in BitCoin. The resulting hash is in big endian form.
Calculates the SHA - 256 hash of the given byte range and then hashes the resulting hash again . This is standard procedure in BitCoin . The resulting hash is in big endian form .
public static byte[] DoubleDigest(byte[] input, int offset, int length)
        {
            var algorithm = new Sha256Digest();
            Byte[] firstHash = new Byte[algorithm.GetDigestSize()];
            algorithm.BlockUpdate(input, offset, length);
            algorithm.DoFinal(firstHash, 0);
            Byte[] secondHash = new Byte[algorithm.GetDigestSize()];
            algorithm.BlockUpdate(firstHash, 0, firstHash.Length);
            algorithm.DoFinal(secondHash, 0);
            return secondHash;
        }
public static byte [ ] DoubleDigest ( byte [ ] input , int offset , int length ) { var algorithm = new Sha256Digest ( ) ; Byte [ ] firstHash = new Byte [ algorithm . GetDigestSize ( ) ] ; algorithm . BlockUpdate ( input , offset , length ) ; algorithm . DoFinal ( firstHash , 0 ) ; Byte [ ] secondHash = new Byte [ algorithm . GetDigestSize ( ) ] ; algorithm . BlockUpdate ( firstHash , 0 , firstHash . Length ) ; algorithm . DoFinal ( secondHash , 0 ) ; return secondHash ; }
Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again.
Calculates the SHA - 256 hash of the given byte range and then hashes the resulting hash again .
input
byte[]
offset
int
length
int