OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This test is ripped from package:crypto to test the sha1 functionality copied | 5 // This test is ripped from package:crypto to test the sha1 functionality copied |
6 // into the compiler. | 6 // into the compiler. |
7 | 7 |
8 library sha1_test; | 8 library sha1_test; |
9 import 'package:compiler/src/hash/sha1.dart'; | 9 import 'package:compiler/implementation/hash/sha1.dart'; |
10 | 10 |
11 import "package:unittest/unittest.dart"; | 11 import "package:unittest/unittest.dart"; |
12 | 12 |
13 part 'sha1_long_test_vectors.dart'; | 13 part 'sha1_long_test_vectors.dart'; |
14 part 'sha1_short_test_vectors.dart'; | 14 part 'sha1_short_test_vectors.dart'; |
15 | 15 |
16 | 16 |
17 void main() { | 17 void main() { |
18 test('expected values', _testExpectedValues); | 18 test('expected values', _testExpectedValues); |
19 test('invalid use', _testInvalidUse); | 19 test('invalid use', _testInvalidUse); |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 570 } |
571 | 571 |
572 void _testStandardVectors(inputs, mds) { | 572 void _testStandardVectors(inputs, mds) { |
573 for (var i = 0; i < inputs.length; i++) { | 573 for (var i = 0; i < inputs.length; i++) { |
574 var hash = new SHA1(); | 574 var hash = new SHA1(); |
575 hash.add(inputs[i]); | 575 hash.add(inputs[i]); |
576 var d = hash.close(); | 576 var d = hash.close(); |
577 expect(mds[i], bytesToHex(d), reason: '$i'); | 577 expect(mds[i], bytesToHex(d), reason: '$i'); |
578 } | 578 } |
579 } | 579 } |
OLD | NEW |