| Index: lib/src/utils.dart
|
| diff --git a/lib/src/utils.dart b/lib/src/utils.dart
|
| index 3f8a5c990c53277fb7ad60324e2c4d669124e721..f2f265db1830e66739c6a6fd4c04410181de2c17 100644
|
| --- a/lib/src/utils.dart
|
| +++ b/lib/src/utils.dart
|
| @@ -4,20 +4,23 @@
|
|
|
| library crypto.utils;
|
|
|
| -// Constants.
|
| +/// A bitmask that limits an integer to 8 bits.
|
| const MASK_8 = 0xff;
|
| +
|
| +/// A bitmask that limits an integer to 32 bits.
|
| const MASK_32 = 0xffffffff;
|
| +
|
| +/// The number of bits in a byte.
|
| const BITS_PER_BYTE = 8;
|
| +
|
| +/// The number of bytes in a 32-bit word.
|
| const BYTES_PER_WORD = 4;
|
|
|
| -// Helper methods.
|
| +/// Adds [x] and [y] with 32-bit overflow semantics.
|
| int add32(x, y) => (x + y) & MASK_32;
|
|
|
| -int roundUp(val, n) => (val + n - 1) & -n;
|
| -
|
| -// Helper functions used by more than one hasher.
|
| -
|
| -// Rotate left limiting to unsigned 32-bit values.
|
| +/// Bitwise rotates [val] to the left by [shift], obeying 32-bit overflow
|
| +/// semantics.
|
| int rotl32(int val, int shift) {
|
| var mod_shift = shift & 31;
|
| return ((val << mod_shift) & MASK_32) |
|
|
|