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