environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
crypto: ^3.0.1
import 'dart:convert';
import 'package:crypto/crypto.dart';
void main() {
var password = "nilpointer";
var bytes = utf8.encode(password);
var hashed = sha1.convert(bytes);
print("hashed: ${hashed}");
var password2 = "abc";
if (sha1.convert(utf8.encode(password2)) == hashed) {
print("password and password 2 match");
} else {
print("password and password 2 do not match");
}
}
hashed: 6430fc4a02e8f1b47a540868eb1b62bcf50ae4f1
password and password 2 do not match