hash method
Returns random hash.
algorithm is one of Algorithm.
Example:
Cryptographic().hash(algorithm: Algorithm.md5); // "74d85e475b3d23ce0618f5b6763a1143"
Implementation
String hash({required Algorithm algorithm}) {
final bytes = utf8.encode(uuid);
return switch (algorithm) {
.md5 => md5.convert(bytes).toString(),
.sha1 => sha1.convert(bytes).toString(),
.sha224 => sha224.convert(bytes).toString(),
.sha256 => sha256.convert(bytes).toString(),
.sha384 => sha384.convert(bytes).toString(),
.sha512 => sha512.convert(bytes).toString(),
};
}