mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-14 21:27:22 +00:00
Added repositories using provider package
This commit is contained in:
parent
cad969d98c
commit
d0505a4a58
30 changed files with 1539 additions and 63 deletions
15
lib/utils/crypto.dart
Normal file
15
lib/utils/crypto.dart
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import 'dart:math';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:crypt/crypt.dart';
|
||||
|
||||
String hashPassword(String password) {
|
||||
final random = Random.secure();
|
||||
final saltInts = List<int>.generate(16, (_) => random.nextInt(256));
|
||||
final salt = base64.encode(saltInts);
|
||||
|
||||
return Crypt.sha256(password, salt: salt).toString();
|
||||
}
|
||||
|
||||
bool matchHashedPassword(String hashedPassword, String password) =>
|
||||
Crypt(hashedPassword).match(password);
|
||||
Loading…
Add table
Add a link
Reference in a new issue