getSaltedPasswordHash static method

Future<String> getSaltedPasswordHash(
  1. String salt,
  2. String password
)

Hashes a password and its salt.

Implementation

static Future<String> getSaltedPasswordHash(
  String salt,
  String password,
) async {
  var saltBytes = base64Decode(salt);

  var cub = _getCodeUnitBytes(password.codeUnits);
  var bytes = [...cub, ...saltBytes];
  var hash = await Sha256().hash(bytes);
  var encoded = base64Encode(hash.bytes);
  return encoded;
}