computeX method

  1. @override
BigInt computeX(
  1. Hash digest,
  2. List<int> salt,
  3. List<int> username,
  4. List<int> password,
)
override

Implementation

@override
BigInt computeX(Hash digest, List<int> salt, List<int> username, List<int> password) {
  List<int> c1 = List.empty(growable: true);
  c1.addAll(username);
  c1.addAll(utf8.encode(":"));
  c1.addAll(password);
  var h1 = digest.convert(c1).toString().padLeft(64, '0');
  var saltHexed = BigIntHelper.toPositiveBigInt(BigInt.parse(BigIntHelper.decodeBigInt(Uint8List.fromList(salt)).toString(), radix: 10)).toRadixString(16).padLeft(64, '0');
  var concat = (saltHexed + h1).toUpperCase();
  var bigIntFromHashValue = BigInt.parse(digest.convert(utf8.encode(concat)).toString(), radix: 16);
  var remainder = bigIntFromHashValue.remainder(N);
  return remainder;
}