This repository was archived by the owner on Oct 17, 2024. It is now read-only.
Commit 01b9190 1 parent c714b42 commit 01b9190 Copy full SHA for 01b9190
File tree 3 files changed +13
-6
lines changed
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change
1
+ ## 2.0.5
2
+
3
+ * Changed the max message size instead to 0x3ffffffffffff, which is the largest
4
+ portable value for both JS and the Dart VM.
5
+
1
6
## 2.0.4
2
7
3
8
* Made max message size a BigNum instead of an int so that dart2js can compile
Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ abstract class HashSink implements Sink<List<int>> {
26
26
/// used across invocations of [_iterate] .
27
27
final Uint32List _currentChunk;
28
28
29
+ /// Messages with more than 2^53-1 bits are not supported. (This is the
30
+ /// largest value that is representable on both JS and the Dart VM.)
31
+ /// So the maximum length in bytes is (2^53-1)/8.
32
+ static const _maxMessageLengthInBytes = 0x0003ffffffffffff ;
33
+
29
34
/// The length of the input data so far, in bytes.
30
35
int _lengthInBytes = 0 ;
31
36
@@ -121,12 +126,9 @@ abstract class HashSink implements Sink<List<int>> {
121
126
_pendingData.add (0 );
122
127
}
123
128
124
- if (new BigInt .from (_lengthInBytes) >
125
- (new BigInt .from (2 ).pow (64 ) - BigInt .one)) {
126
- // Messages with more than 2^64-1 bits are not supported.
127
- // So the maximum length in bytes is (2^64-1)/8.
129
+ if (_lengthInBytes > _maxMessageLengthInBytes) {
128
130
throw new UnsupportedError (
129
- 'Hashing is unsupported for messages with more than 2^64 bits.' );
131
+ 'Hashing is unsupported for messages with more than 2^53 bits.' );
130
132
}
131
133
132
134
var lengthInBits = _lengthInBytes * bitsPerByte;
Original file line number Diff line number Diff line change 1
1
name : crypto
2
- version : 2.0.4
2
+ version : 2.0.5
3
3
author : Dart Team <misc@dartlang.org>
4
4
description : Library of cryptographic functions.
5
5
homepage : https://github.com/dart-lang/crypto
You can’t perform that action at this time.
0 commit comments