Fixes a invalid length hash due to the way dart outputs hex
This commit is contained in:
parent
b2f12eae15
commit
9348bf1370
2 changed files with 11 additions and 3 deletions
|
@ -7,7 +7,7 @@ class Hashing {
|
|||
var hash = md5.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
x += byte.toRadixString(16).padLeft(2, '0');
|
||||
}
|
||||
|
||||
return x;
|
||||
|
@ -17,7 +17,7 @@ class Hashing {
|
|||
var hash = sha1.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
x += byte.toRadixString(16).padLeft(2, '0');
|
||||
}
|
||||
|
||||
return x;
|
||||
|
@ -27,7 +27,7 @@ class Hashing {
|
|||
var hash = sha256.convert(utf8.encode(input)).bytes;
|
||||
String x = "";
|
||||
for (int byte in hash) {
|
||||
x += byte.toRadixString(16);
|
||||
x += byte.toRadixString(16).padLeft(2, '0');
|
||||
}
|
||||
|
||||
return x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue