fixed some strong-mode and analyzer issues
R=nweiz@google.com
Review URL: https://codereview.chromium.org//1826863003 .
diff --git a/lib/src/sha256.dart b/lib/src/sha256.dart
index 0145363..e5cb5bb 100644
--- a/lib/src/sha256.dart
+++ b/lib/src/sha256.dart
@@ -80,13 +80,13 @@
// The following helper functions are taken directly from
// http://tools.ietf.org/html/rfc6234.
- _rotr32(int n, int x) => (x >> n) | ((x << (32 - n)) & mask32);
- _ch(int x, int y, int z) => (x & y) ^ ((~x & mask32) & z);
- _maj(int x, int y, int z) => (x & y) ^ (x & z) ^ (y & z);
- _bsig0(int x) => _rotr32(2, x) ^ _rotr32(13, x) ^ _rotr32(22, x);
- _bsig1(int x) => _rotr32(6, x) ^ _rotr32(11, x) ^ _rotr32(25, x);
- _ssig0(int x) => _rotr32(7, x) ^ _rotr32(18, x) ^ (x >> 3);
- _ssig1(int x) => _rotr32(17, x) ^ _rotr32(19, x) ^ (x >> 10);
+ int _rotr32(int n, int x) => (x >> n) | ((x << (32 - n)) & mask32);
+ int _ch(int x, int y, int z) => (x & y) ^ ((~x & mask32) & z);
+ int _maj(int x, int y, int z) => (x & y) ^ (x & z) ^ (y & z);
+ int _bsig0(int x) => _rotr32(2, x) ^ _rotr32(13, x) ^ _rotr32(22, x);
+ int _bsig1(int x) => _rotr32(6, x) ^ _rotr32(11, x) ^ _rotr32(25, x);
+ int _ssig0(int x) => _rotr32(7, x) ^ _rotr32(18, x) ^ (x >> 3);
+ int _ssig1(int x) => _rotr32(17, x) ^ _rotr32(19, x) ^ (x >> 10);
void updateHash(Uint32List chunk) {
assert(chunk.length == 16);
diff --git a/test/sha1_test.dart b/test/sha1_test.dart
index 552b862..5b7398b 100644
--- a/test/sha1_test.dart
+++ b/test/sha1_test.dart
@@ -10,13 +10,15 @@
void main() {
group("with a chunked converter", () {
test('add may not be called after close', () {
- var sink = sha1.startChunkedConversion(new StreamController().sink);
+ var sink =
+ sha1.startChunkedConversion(new StreamController<Digest>().sink);
sink.close();
expect(() => sink.add([0]), throwsStateError);
});
test('close may be called multiple times', () {
- var sink = sha1.startChunkedConversion(new StreamController().sink);
+ var sink =
+ sha1.startChunkedConversion(new StreamController<Digest>().sink);
sink.close();
sink.close();
sink.close();
@@ -36,7 +38,7 @@
// Standard test vectors from:
// http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip
-const _inputs = const [
+const _inputs = const <List<int>>[
const [ ],
const [ 0x36 ],
const [ 0x19, 0x5a ],
diff --git a/test/sha256_test.dart b/test/sha256_test.dart
index 75fb9e3..a56d75a 100644
--- a/test/sha256_test.dart
+++ b/test/sha256_test.dart
@@ -7,18 +7,18 @@
import "package:test/test.dart";
import "package:crypto/crypto.dart";
-import "utils.dart";
-
void main() {
group("with a chunked converter", () {
test('add may not be called after close', () {
- var sink = sha256.startChunkedConversion(new StreamController().sink);
+ var sink =
+ sha256.startChunkedConversion(new StreamController<Digest>().sink);
sink.close();
expect(() => sink.add([0]), throwsStateError);
});
test('close may be called multiple times', () {
- var sink = sha256.startChunkedConversion(new StreamController().sink);
+ var sink =
+ sha256.startChunkedConversion(new StreamController<Digest>().sink);
sink.close();
sink.close();
sink.close();
@@ -38,7 +38,7 @@
// Standard test vectors from:
// http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip
-const _inputs = const [
+const _inputs = const <List<int>>[
const [ ],
const [ 0xd3 ],
const [ 0x11, 0xaf ],