Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: lib/src/utils.dart

Issue 1348983002: Update documentation comments. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Code review changes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/sha256.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.utils; 5 library crypto.utils;
6 6
7 // Constants. 7 /// A bitmask that limits an integer to 8 bits.
8 const MASK_8 = 0xff; 8 const MASK_8 = 0xff;
9
10 /// A bitmask that limits an integer to 32 bits.
9 const MASK_32 = 0xffffffff; 11 const MASK_32 = 0xffffffff;
12
13 /// The number of bits in a byte.
10 const BITS_PER_BYTE = 8; 14 const BITS_PER_BYTE = 8;
15
16 /// The number of bytes in a 32-bit word.
11 const BYTES_PER_WORD = 4; 17 const BYTES_PER_WORD = 4;
12 18
13 // Helper methods. 19 /// Adds [x] and [y] with 32-bit overflow semantics.
14 int add32(x, y) => (x + y) & MASK_32; 20 int add32(x, y) => (x + y) & MASK_32;
15 21
16 int roundUp(val, n) => (val + n - 1) & -n; 22 /// Bitwise rotates [val] to the left by [shift], obeying 32-bit overflow
17 23 /// semantics.
18 // Helper functions used by more than one hasher.
19
20 // Rotate left limiting to unsigned 32-bit values.
21 int rotl32(int val, int shift) { 24 int rotl32(int val, int shift) {
22 var mod_shift = shift & 31; 25 var mod_shift = shift & 31;
23 return ((val << mod_shift) & MASK_32) | 26 return ((val << mod_shift) & MASK_32) |
24 ((val & MASK_32) >> (32 - mod_shift)); 27 ((val & MASK_32) >> (32 - mod_shift));
25 } 28 }
OLDNEW
« no previous file with comments | « lib/src/sha256.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698