| 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 library crypto.hash_base; | 5 library crypto.hash_base; |
| 6 | 6 |
| 7 import 'dart:math' as math; | |
| 8 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 9 | 8 |
| 10 import 'hash.dart'; | 9 import 'hash.dart'; |
| 11 import 'utils.dart'; | 10 import 'utils.dart'; |
| 12 | 11 |
| 13 /// A base class for [Hash] implementations. | 12 /// A base class for [Hash] implementations. |
| 14 /// | 13 /// |
| 15 /// Subclasses should override [updateHash], and define it to update [h] with | 14 /// Subclasses should override [updateHash], and define it to update [h] with |
| 16 /// the results of the hash function. | 15 /// the results of the hash function. |
| 17 abstract class HashBase implements Hash { | 16 abstract class HashBase implements Hash { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 _pendingData.addAll(_wordToBytes(lengthInBits & MASK_32)); | 166 _pendingData.addAll(_wordToBytes(lengthInBits & MASK_32)); |
| 168 } else { | 167 } else { |
| 169 _pendingData.addAll(_wordToBytes(lengthInBits & MASK_32)); | 168 _pendingData.addAll(_wordToBytes(lengthInBits & MASK_32)); |
| 170 _pendingData.addAll(_wordToBytes((lengthInBits >> 32) & MASK_32)); | 169 _pendingData.addAll(_wordToBytes((lengthInBits >> 32) & MASK_32)); |
| 171 } | 170 } |
| 172 } | 171 } |
| 173 | 172 |
| 174 /// Rounds [val] to the nearest multiple of [n]. | 173 /// Rounds [val] to the nearest multiple of [n]. |
| 175 int _roundUp(val, n) => (val + n - 1) & -n; | 174 int _roundUp(val, n) => (val + n - 1) & -n; |
| 176 } | 175 } |
| OLD | NEW |