/// <summary> /// Calculates checksum (first 4 bytes of 2x SHA256) of a given byte array. /// </summary> /// <exception cref="ArgumentNullException"/> /// <param name="data">An array of bytes.</param> /// <returns>Checksum byte sequence (first 4 bytes of 2x SHA256).</returns> private byte[] CalculateCheckSum(byte[] data) { if (data == null) { throw new ArgumentNullException(nameof(data), "Cannot calculate checksum of null input!"); } return(HashFunctions.ComputeDoubleSha256(data).SubArray(0, CheckSumSize)); }
public string GetWitnessTransactionID() { return(HashFunctions.ComputeDoubleSha256(Serialize()).Reverse().ToArray().ToBase16()); }
public string GetTransactionID() { byte[] bytesToHash = (Flag == 1) ? SerializeWithoutWitness() : Serialize(); return(HashFunctions.ComputeDoubleSha256(bytesToHash).Reverse().ToArray().ToBase16()); }