match method
Tests if a value hashes to the same hash.
Returns true if the hash of the value
matches this crypt hash. Otherwise
false is returned.
Implementation
bool match(String value) {
// Hash the value using the same parameters
Crypt that;
switch (_type) {
case idSha256:
that = Crypt.sha256(value, rounds: _rounds, salt: _salt);
break;
case idSha512:
that = Crypt.sha512(value, rounds: _rounds, salt: _salt);
break;
default:
throw StateError('Crypt: invalid algorithm: $_type');
}
// Compare the two
return this == that;
}