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 part of crypto; | 5 part of crypto; |
6 | 6 |
7 /** | 7 /** |
8 * MD5 hash function implementation. | 8 * MD5 hash function implementation. |
9 * | 9 * |
10 * WARNING: MD5 has known collisions and should only be used when | 10 * WARNING: MD5 has known collisions and should only be used when |
(...skipping 26 matching lines...) Expand all Loading... |
37 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]; | 37 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391 ]; |
38 | 38 |
39 static const _r = const [ | 39 static const _r = const [ |
40 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, | 40 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, |
41 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, | 41 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, |
42 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, | 42 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, |
43 10, 15, 21, 6, 10, 15, 21 ]; | 43 10, 15, 21, 6, 10, 15, 21 ]; |
44 | 44 |
45 // Compute one iteration of the MD5 algorithm with a chunk of | 45 // Compute one iteration of the MD5 algorithm with a chunk of |
46 // 16 32-bit pieces. | 46 // 16 32-bit pieces. |
47 void _updateHash(List<int> m) { | 47 void _updateHash(Uint32List m) { |
48 assert(m.length == 16); | 48 assert(m.length == 16); |
49 | 49 |
50 var a = _h[0]; | 50 var a = _h[0]; |
51 var b = _h[1]; | 51 var b = _h[1]; |
52 var c = _h[2]; | 52 var c = _h[2]; |
53 var d = _h[3]; | 53 var d = _h[3]; |
54 | 54 |
55 var t0; | 55 var t0; |
56 var t1; | 56 var t1; |
57 | 57 |
(...skipping 20 matching lines...) Expand all Loading... |
78 _r[i])); | 78 _r[i])); |
79 a = temp; | 79 a = temp; |
80 } | 80 } |
81 | 81 |
82 _h[0] = _add32(a, _h[0]); | 82 _h[0] = _add32(a, _h[0]); |
83 _h[1] = _add32(b, _h[1]); | 83 _h[1] = _add32(b, _h[1]); |
84 _h[2] = _add32(c, _h[2]); | 84 _h[2] = _add32(c, _h[2]); |
85 _h[3] = _add32(d, _h[3]); | 85 _h[3] = _add32(d, _h[3]); |
86 } | 86 } |
87 } | 87 } |
OLD | NEW |