feat: agregar clase PasswordHasher para el hash de contraseñas
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -8,5 +8,6 @@
|
|||||||
],
|
],
|
||||||
"yaml.schemas": {
|
"yaml.schemas": {
|
||||||
"https://raw.githubusercontent.com/doanthuanthanh88/testapi6/main/schema.json": "*.yaml"
|
"https://raw.githubusercontent.com/doanthuanthanh88/testapi6/main/schema.json": "*.yaml"
|
||||||
}
|
},
|
||||||
|
"cmake.sourceDirectory": "C:/Users/Mendez/Documents/Practicas de programacion/Proyecto-Hackathon (ITC)/hackathon-sfc-a9a4cee23109413188ee35ceac01dc07/windows"
|
||||||
}
|
}
|
||||||
13
lib/core/security/password_hasher.dart
Normal file
13
lib/core/security/password_hasher.dart
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:crypto/crypto.dart';
|
||||||
|
|
||||||
|
class PasswordHasher {
|
||||||
|
static const String _salt = 'waste-notify-local-salt-v1';
|
||||||
|
|
||||||
|
static String hash(String password) {
|
||||||
|
final normalized = password.trim();
|
||||||
|
final bytes = utf8.encode('$_salt:$normalized');
|
||||||
|
return sha256.convert(bytes).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user