Closed yeikel16 closed 10 months ago
I build my hashResult
final argument = 'This is my String argument';
final algorithm = Sha256();
final argumentHash = utf8.encode(argument);
final hashResult = await algorithm.hash(argumentHash);
and convert the hashResult
to String with this function:
static String _hexEncode(List<int> bytes) {
const hexDigits = '0123456789abcdef';
var charCodes = Uint8List(bytes.length * 2);
for (var i = 0, j = 0; i < bytes.length; i++) {
var byte = bytes[i];
charCodes[j++] = hexDigits.codeUnitAt((byte >> 4) & 0xF);
charCodes[j++] = hexDigits.codeUnitAt(byte & 0xF);
}
return String.fromCharCodes(charCodes);
}
Hi, I building a Sha256 hash but I need the string from bytes list. How I can get this?