Assets/Scripts/BIP39/Utilities.cs
/// <summary>
/// Calculates the SHA256 32 byte checksum of the input bytes
/// </summary>
/// <param name="input">bytes input to get checksum</param>
/// <param name="offset">where to start calculating checksum</param>
/// <param name="length">length of the input bytes to perform checksum on</param>
/// <returns>32 byte array checksum</returns>
Calculates the SHA256 32 byte checksum of the input bytes
Calculates the SHA256 32 byte checksum of the input bytes
public static byte[] Sha256Digest(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);
            return firstHash;
        }
public static byte [ ] Sha256Digest ( 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 ) ; return firstHash ; }
Calculates the SHA256 32 byte checksum of the input bytes
Calculates the SHA256 32 byte checksum of the input bytes
32 byte array checksum
32 byte array checksum
input
byte[]
bytes input to get checksum
bytes input to get checksum
offset
int
None
length
int
length of the input bytes to perform checksum on
length of the input bytes to perform checksum on