string method
Process the input
string and returns a HashDigest.
If the encoding
is not specified, codeUnits
are used as input bytes.
Implementation
HashDigest string(String input, [Encoding? encoding]) {
final sink = createSink();
if (encoding != null) {
final data = encoding.encode(input);
sink.add(data);
} else {
sink.add(input.codeUnits);
}
return sink.digest();
}