getHashDigest function
Uint8List
getHashDigest(
- dynamic content,
- dynamic algo
)
Implementation
Uint8List getHashDigest(dynamic content, dynamic algo) {
switch (algo) {
case 'sha256':
final Digest sha256 = Digest('SHA-256');
return sha256.process(content);
case 'sha512':
final Digest sha512 = Digest('SHA-512');
return sha512.process(content);
case 'sha3-256':
final Digest sha3_256 = Digest('SHA3-256');
return sha3_256.process(content);
case 'sha3-512':
final Digest sha3_512 = Digest('SHA3-512');
return sha3_512.process(content);
case 'blake2b':
final Digest blake2b = Digest('Blake2b');
return blake2b.process(content);
default:
throw 'Hash algorithm not supported';
}
}