This repository was archived by the owner on Oct 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.1.3
2
+ * ** Security vulnerability** : Fixed constant-time comparison in ` Digest ` .
3
+
1
4
## 2.1.2
2
5
* Fix bug in SHA-2 384/512 blocksize.
3
6
* Added HMAC-SHA-2 test vectors
Original file line number Diff line number Diff line change @@ -17,8 +17,22 @@ class Digest {
17
17
/// This should be used instead of manual comparisons to avoid leaking
18
18
/// information via timing.
19
19
@override
20
- bool operator == (Object other) =>
21
- other is Digest && const ListEquality ().equals (bytes, other.bytes);
20
+ bool operator == (Object other) {
21
+ if (other is Digest ) {
22
+ final a = bytes;
23
+ final b = other.bytes;
24
+ if (a.length != b.length) {
25
+ return false ;
26
+ }
27
+ final n = a.length;
28
+ int mismatch = 0 ;
29
+ for (int i = 0 ; i < n; i++ ) {
30
+ mismatch | = a[i] ^ b[i];
31
+ }
32
+ return mismatch == 0 ;
33
+ }
34
+ return false ;
35
+ }
22
36
23
37
@override
24
38
int get hashCode => const ListEquality ().hash (bytes);
Original file line number Diff line number Diff line change 1
1
name : crypto
2
- version : 2.1.2
2
+ version : 2.1.3
3
3
author : Dart Team <misc@dartlang.org>
4
4
description : Library of cryptographic functions.
5
5
homepage : https://www.github.com/dart-lang/crypto
You can’t perform that action at this time.
0 commit comments