operator == method
- Object other
override
Returns whether this is equal to another digest.
This should be used instead of manual comparisons to avoid leaking information via timing.
Implementation
@override
bool operator ==(Object other) {
if (other is Digest) {
final a = bytes;
final b = other.bytes;
final n = a.length;
if (n != b.length) {
return false;
}
var mismatch = 0;
for (var i = 0; i < n; i++) {
mismatch |= a[i] ^ b[i];
}
return mismatch == 0;
}
return false;
}