doubleHash function

Uint8List doubleHash(
  1. Uint8List buffer
)

This function calculates a double SHA-256 hash of the provided input buffer. Double hashing is commonly used in blockchain and cryptographic applications.

Implementation

Uint8List doubleHash(Uint8List buffer) {
  /// Calculate the first SHA-256 hash of the input buffer.
  Uint8List tmp = SHA256Digest().process(buffer);

  /// Calculate the second SHA-256 hash of the first hash result.
  return SHA256Digest().process(tmp);
}