move to pkg:dart_flutter_team_lints, require Dart 2.19 (#141)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 8c8f4ab..20b28de 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
- sdk: [2.14.0, dev]
+ sdk: [2.19.0, dev]
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6e0aa77..a4141fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
## 3.0.3-dev
+* Require Dart 2.19.0.
+
## 3.0.2
* Require Dart 2.14.0.
@@ -12,13 +14,7 @@
## 3.0.0
* Stable release for null safety.
-
-## 3.0.0-nullsafety.0
-
-Null safety migration of this package.
-
* Adds SHA-2 512/224 and SHA-2 512/256 from FIPS 180-4
-
* Removes `newInstance` instance members on some classes
and updates documentation.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index ff4a7e8..abf3b91 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,4 +1,4 @@
-include: package:lints/recommended.yaml
+include: package:dart_flutter_team_lints/analysis_options.yaml
analyzer:
language:
@@ -8,40 +8,7 @@
linter:
rules:
- - avoid_empty_else
- - avoid_init_to_null
- - avoid_null_checks_in_equality_operators
- avoid_unused_constructor_parameters
- - await_only_futures
- - camel_case_types
- cancel_subscriptions
- - constant_identifier_names
- - control_flow_in_finally
- - directives_ordering
- - empty_catches
- - empty_constructor_bodies
- - empty_statements
- - hash_and_equals
- - implementation_imports
- - iterable_contains_unrelated_type
- - library_names
- - library_prefixes
- - list_remove_unrelated_type
- - non_constant_identifier_names
- - overridden_fields
- package_api_docs
- - package_names
- - package_prefixed_library_names
- - prefer_equal_for_default_values
- - prefer_final_fields
- - prefer_generic_function_type_aliases
- - prefer_is_not_empty
- - slash_for_doc_comments
- test_types_in_equals
- - throw_in_finally
- - type_init_formals
- - unnecessary_brace_in_string_interps
- - unnecessary_const
- - unnecessary_new
- - unrelated_type_equality_checks
- - valid_regexps
diff --git a/lib/src/sha1.dart b/lib/src/sha1.dart
index 46449ab..3120c58 100644
--- a/lib/src/sha1.dart
+++ b/lib/src/sha1.dart
@@ -79,7 +79,7 @@
if (i < 20) {
newA = add32(add32(newA, (b & c) | (~b & d)), 0x5A827999);
} else if (i < 40) {
- newA = add32(add32(newA, (b ^ c ^ d)), 0x6ED9EBA1);
+ newA = add32(add32(newA, b ^ c ^ d), 0x6ED9EBA1);
} else if (i < 60) {
newA = add32(add32(newA, (b & c) | (b & d) | (c & d)), 0x8F1BBCDC);
} else {
diff --git a/lib/src/sha512_fastsinks.dart b/lib/src/sha512_fastsinks.dart
index 0e07af6..636af26 100644
--- a/lib/src/sha512_fastsinks.dart
+++ b/lib/src/sha512_fastsinks.dart
@@ -129,19 +129,20 @@
Sha512Sink(Sink<Digest> sink)
: super(
- sink,
- Uint64List.fromList([
- // Initial value of the hash parts. First 64 bits of the fractional
- // parts of the square roots of the first eight prime numbers.
- 0x6a09e667f3bcc908,
- 0xbb67ae8584caa73b,
- 0x3c6ef372fe94f82b,
- 0xa54ff53a5f1d36f1,
- 0x510e527fade682d1,
- 0x9b05688c2b3e6c1f,
- 0x1f83d9abfb41bd6b,
- 0x5be0cd19137e2179,
- ]));
+ sink,
+ Uint64List.fromList([
+ // Initial value of the hash parts. First 64 bits of the fractional
+ // parts of the square roots of the first eight prime numbers.
+ 0x6a09e667f3bcc908,
+ 0xbb67ae8584caa73b,
+ 0x3c6ef372fe94f82b,
+ 0xa54ff53a5f1d36f1,
+ 0x510e527fade682d1,
+ 0x9b05688c2b3e6c1f,
+ 0x1f83d9abfb41bd6b,
+ 0x5be0cd19137e2179,
+ ]),
+ );
}
/// The concrete implementation of [Sha512/224].
diff --git a/lib/src/sha512_slowsinks.dart b/lib/src/sha512_slowsinks.dart
index 71225ec..5c5d597 100644
--- a/lib/src/sha512_slowsinks.dart
+++ b/lib/src/sha512_slowsinks.dart
@@ -79,7 +79,7 @@
void _shr(
int bits, Uint32List word, int offset, Uint32List ret, int offsetR) {
ret[0 + offsetR] =
- ((bits < 32) && (bits >= 0)) ? (word[0 + offset] >> (bits)) : 0;
+ ((bits < 32) && (bits >= 0)) ? (word[0 + offset] >> bits) : 0;
ret[1 + offsetR] = (bits > 32)
? (word[0 + offset] >> (bits - 32))
: (bits == 32)
@@ -118,18 +118,17 @@
void _add(Uint32List word1, int offset1, Uint32List word2, int offset2,
Uint32List ret, int offsetR) {
- ret[1 + offsetR] = (word1[1 + offset1] + word2[1 + offset2]);
+ ret[1 + offsetR] = word1[1 + offset1] + word2[1 + offset2];
ret[0 + offsetR] = word1[0 + offset1] +
word2[0 + offset2] +
(ret[1 + offsetR] < word1[1 + offset1] ? 1 : 0);
}
void _addTo2(Uint32List word1, int offset1, Uint32List word2, int offset2) {
- int _addTemp;
- _addTemp = word1[1 + offset1];
+ var addTemp = word1[1 + offset1];
word1[1 + offset1] += word2[1 + offset2];
word1[0 + offset1] +=
- word2[0 + offset2] + (word1[1 + offset1] < _addTemp ? 1 : 0);
+ word2[0 + offset2] + (word1[1 + offset1] < addTemp ? 1 : 0);
}
static const _rotrIndex1 = 0;
@@ -196,17 +195,17 @@
void _ch(Uint32List x, int offsetX, Uint32List y, int offsetY, Uint32List z,
int offsetZ, Uint32List ret, int offsetR) {
ret[0 + offsetR] =
- ((x[0 + offsetX] & (y[0 + offsetY] ^ z[0 + offsetZ])) ^ z[0 + offsetZ]);
+ (x[0 + offsetX] & (y[0 + offsetY] ^ z[0 + offsetZ])) ^ z[0 + offsetZ];
ret[1 + offsetR] =
- ((x[1 + offsetX] & (y[1 + offsetY] ^ z[1 + offsetZ])) ^ z[1 + offsetZ]);
+ (x[1 + offsetX] & (y[1 + offsetY] ^ z[1 + offsetZ])) ^ z[1 + offsetZ];
}
void _maj(Uint32List x, int offsetX, Uint32List y, int offsetY, Uint32List z,
int offsetZ, Uint32List ret, int offsetR) {
- ret[0 + offsetR] = ((x[0 + offsetX] & (y[0 + offsetY] | z[0 + offsetZ])) |
- (y[0 + offsetY] & z[0 + offsetZ]));
- ret[1 + offsetR] = ((x[1 + offsetX] & (y[1 + offsetY] | z[1 + offsetZ])) |
- (y[1 + offsetY] & z[1 + offsetZ]));
+ ret[0 + offsetR] = (x[0 + offsetX] & (y[0 + offsetY] | z[0 + offsetZ])) |
+ (y[0 + offsetY] & z[0 + offsetZ]);
+ ret[1 + offsetR] = (x[1 + offsetX] & (y[1 + offsetY] | z[1 + offsetZ])) |
+ (y[1 + offsetY] & z[1 + offsetZ]);
}
@override
@@ -313,19 +312,20 @@
Sha512Sink(Sink<Digest> sink)
: super(
- sink,
- Uint32List.fromList([
- // Initial value of the hash parts. First 64 bits of the fractional
- // parts of the square roots of the first eight prime numbers.
- 0x6a09e667, 0xf3bcc908,
- 0xbb67ae85, 0x84caa73b,
- 0x3c6ef372, 0xfe94f82b,
- 0xa54ff53a, 0x5f1d36f1,
- 0x510e527f, 0xade682d1,
- 0x9b05688c, 0x2b3e6c1f,
- 0x1f83d9ab, 0xfb41bd6b,
- 0x5be0cd19, 0x137e2179,
- ]));
+ sink,
+ Uint32List.fromList([
+ // Initial value of the hash parts. First 64 bits of the fractional
+ // parts of the square roots of the first eight prime numbers.
+ 0x6a09e667, 0xf3bcc908,
+ 0xbb67ae85, 0x84caa73b,
+ 0x3c6ef372, 0xfe94f82b,
+ 0xa54ff53a, 0x5f1d36f1,
+ 0x510e527f, 0xade682d1,
+ 0x9b05688c, 0x2b3e6c1f,
+ 0x1f83d9ab, 0xfb41bd6b,
+ 0x5be0cd19, 0x137e2179,
+ ]),
+ );
}
/// The concrete implementation of [Sha512/224].
diff --git a/pubspec.yaml b/pubspec.yaml
index 83831f4..65321b4 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,12 +4,12 @@
repository: https://github.com/dart-lang/crypto
environment:
- sdk: '>=2.14.0 <3.0.0'
+ sdk: '>=2.19.0 <3.0.0'
dependencies:
typed_data: ^1.3.0
dev_dependencies:
convert: ^3.0.0
- lints: ^1.0.0
+ dart_flutter_team_lints: ^1.0.0
test: ^1.16.0
diff --git a/test/hmac_md5_test.dart b/test/hmac_md5_test.dart
index b3603fb..0cbcec0 100644
--- a/test/hmac_md5_test.dart
+++ b/test/hmac_md5_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'package:crypto/crypto.dart';
import 'package:test/test.dart';
diff --git a/test/hmac_sha1_test.dart b/test/hmac_sha1_test.dart
index cdabde0..c7dafa5 100644
--- a/test/hmac_sha1_test.dart
+++ b/test/hmac_sha1_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'package:crypto/crypto.dart';
import 'package:test/test.dart';
diff --git a/test/hmac_sha256_test.dart b/test/hmac_sha256_test.dart
index d797002..7b8cbab 100644
--- a/test/hmac_sha256_test.dart
+++ b/test/hmac_sha256_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'package:crypto/crypto.dart';
import 'package:test/test.dart';
diff --git a/test/hmac_sha2_test.dart b/test/hmac_sha2_test.dart
index 67a3a47..4f2abfa 100644
--- a/test/hmac_sha2_test.dart
+++ b/test/hmac_sha2_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'package:crypto/crypto.dart';
import 'package:test/test.dart';
@@ -112,16 +114,16 @@
bool truncation = false,
}) {
test(name, () {
- final _key = bytesFromHexString(key);
- final _data = bytesFromHexString(data);
+ final keyBytes = bytesFromHexString(key);
+ final dataBytes = bytesFromHexString(data);
- expect(Hmac(sha224, _key).convert(_data).toString(),
+ expect(Hmac(sha224, keyBytes).convert(dataBytes).toString(),
truncation ? startsWith(hmacSha224) : hmacSha224);
- expect(Hmac(sha256, _key).convert(_data).toString(),
+ expect(Hmac(sha256, keyBytes).convert(dataBytes).toString(),
truncation ? startsWith(hmacSha256) : hmacSha256);
- expect(Hmac(sha384, _key).convert(_data).toString(),
+ expect(Hmac(sha384, keyBytes).convert(dataBytes).toString(),
truncation ? startsWith(hmacSha384) : hmacSha384);
- expect(Hmac(sha512, _key).convert(_data).toString(),
+ expect(Hmac(sha512, keyBytes).convert(dataBytes).toString(),
truncation ? startsWith(hmacSha512) : hmacSha512);
});
}
diff --git a/test/sha1_test.dart b/test/sha1_test.dart
index fe1f718..f5bb31d 100644
--- a/test/sha1_test.dart
+++ b/test/sha1_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'dart:async';
import 'dart:convert';
diff --git a/test/sha256_test.dart b/test/sha256_test.dart
index 26cbf55..bd8d23f 100644
--- a/test/sha256_test.dart
+++ b/test/sha256_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'dart:async';
import 'dart:convert';
@@ -34,10 +36,11 @@
expectAsync1((accumulated) {
expect(accumulated.length, equals(1));
expect(
- accumulated.first.toString(),
- equals(
- 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b8'
- '55'));
+ accumulated.first.toString(),
+ equals(
+ 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b8'
+ '55'),
+ );
}));
var outer = sha256.startChunkedConversion(inner);
diff --git a/test/sha512_test.dart b/test/sha512_test.dart
index 86341ed..07ad788 100644
--- a/test/sha512_test.dart
+++ b/test/sha512_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'dart:async';
import 'dart:convert';
@@ -32,9 +34,10 @@
expectAsync1((accumulated) {
expect(accumulated.length, equals(1));
expect(
- accumulated.first.toString(),
- equals(
- '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b'));
+ accumulated.first.toString(),
+ equals(
+ '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b'),
+ );
}));
var outer = sha384.startChunkedConversion(inner);
diff --git a/test/sha_monte_test.dart b/test/sha_monte_test.dart
index c7fcbaf..ae830a9 100644
--- a/test/sha_monte_test.dart
+++ b/test/sha_monte_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// ignore_for_file: lines_longer_than_80_chars
+
import 'dart:typed_data';
import 'package:crypto/crypto.dart';
@@ -93,12 +95,12 @@
void monteTest(String name, Hash hash, String seed, List<String> expected) {
test(name, () {
Iterable<String> run() sync* {
- var _seed = bytesFromHexString(seed);
+ var seedBytes = bytesFromHexString(seed);
for (var j = 0; j < expected.length; j++) {
Uint8List md0, md1, md2;
- md0 = Uint8List.fromList(_seed);
- md1 = Uint8List.fromList(_seed);
- md2 = Uint8List.fromList(_seed);
+ md0 = Uint8List.fromList(seedBytes);
+ md1 = Uint8List.fromList(seedBytes);
+ md2 = Uint8List.fromList(seedBytes);
late Digest mdI;
for (var i = 3; i < 1003; i++) {
var mI = [...md0, ...md1, ...md2];
@@ -108,7 +110,7 @@
md2.setAll(0, mdI.bytes);
}
yield '$mdI';
- _seed.setAll(0, md2);
+ seedBytes.setAll(0, md2);
}
}