mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
18 lines
511 B
Dart
18 lines
511 B
Dart
import 'dart:convert';
|
|
import 'package:crypto/crypto.dart';
|
|
|
|
class PasswordHasher {
|
|
/// Hash a password using SHA256 (simple implementation)
|
|
/// Note: In production, use a proper bcrypt implementation
|
|
static String hash(String password) {
|
|
final bytes = utf8.encode(password);
|
|
final digest = sha256.convert(bytes);
|
|
return digest.toString();
|
|
}
|
|
|
|
/// Verify a password against a hash
|
|
static bool verify(String password, String hash) {
|
|
return PasswordHasher.hash(password) == hash;
|
|
}
|
|
}
|