| 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; | |
| 6 | |
| 7 import 'dart:typed_data'; | 5 import 'dart:typed_data'; |
| 8 | 6 |
| 9 import 'package:typed_data/typed_data.dart'; | 7 import 'package:typed_data/typed_data.dart'; |
| 10 | 8 |
| 11 import 'digest.dart'; | 9 import 'digest.dart'; |
| 12 import 'utils.dart'; | 10 import 'utils.dart'; |
| 13 | 11 |
| 14 /// A base class for [Sink] implementations for hash algorithms. | 12 /// A base class for [Sink] implementations for hash algorithms. |
| 15 /// | 13 /// |
| 16 /// Subclasses should override [updateHash] and [digest]. | 14 /// Subclasses should override [updateHash] and [digest]. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // hash. | 128 // hash. |
| 131 var offset = _pendingData.length; | 129 var offset = _pendingData.length; |
| 132 _pendingData.addAll(new Uint8List(8)); | 130 _pendingData.addAll(new Uint8List(8)); |
| 133 _pendingData.buffer.asByteData().setUint64(offset, lengthInBits, _endian); | 131 _pendingData.buffer.asByteData().setUint64(offset, lengthInBits, _endian); |
| 134 } | 132 } |
| 135 | 133 |
| 136 /// Rounds [val] up to the next multiple of [n], as long as [n] is a power of | 134 /// Rounds [val] up to the next multiple of [n], as long as [n] is a power of |
| 137 /// two. | 135 /// two. |
| 138 int _roundUp(int val, int n) => (val + n - 1) & -n; | 136 int _roundUp(int val, int n) => (val + n - 1) & -n; |
| 139 } | 137 } |
| OLD | NEW |