sha256<T extends Object?> static method

T sha256<T extends Object?>(
  1. T use(
    1. BuSerializableHash<BuHashState> cipher
    )
)

Runs use with a fresh SHA-256 hash, then wipes it. The instance must be clean after you don't need it; this method guarantees that, even if use throws.

Implementation

static T sha256<T extends Object?>(
  T Function(BuSerializableHash cipher) use,
) {
  final cipher = sha256Instance();
  try {
    return use(cipher);
  } finally {
    cipher.clean();
  }
}