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

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

Issue 1586453002: Get rid of all the library tags. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Created 4 years, 11 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') | test/hmac_sha1_test.dart » ('j') | 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;
6
7 /// A bitmask that limits an integer to 32 bits. 5 /// A bitmask that limits an integer to 32 bits.
8 const mask32 = 0xFFFFFFFF; 6 const mask32 = 0xFFFFFFFF;
9 7
10 /// The highest value representable by a 64-bit unsigned integer. 8 /// The highest value representable by a 64-bit unsigned integer.
11 const maxUint64 = 0xFFFFFFFFFFFFFFFF; 9 const maxUint64 = 0xFFFFFFFFFFFFFFFF;
12 10
13 /// The number of bits in a byte. 11 /// The number of bits in a byte.
14 const bitsPerByte = 8; 12 const bitsPerByte = 8;
15 13
16 /// The number of bytes in a 32-bit word. 14 /// The number of bytes in a 32-bit word.
17 const bytesPerWord = 4; 15 const bytesPerWord = 4;
18 16
19 /// Adds [x] and [y] with 32-bit overflow semantics. 17 /// Adds [x] and [y] with 32-bit overflow semantics.
20 int add32(int x, int y) => (x + y) & mask32; 18 int add32(int x, int y) => (x + y) & mask32;
21 19
22 /// Bitwise rotates [val] to the left by [shift], obeying 32-bit overflow 20 /// Bitwise rotates [val] to the left by [shift], obeying 32-bit overflow
23 /// semantics. 21 /// semantics.
24 int rotl32(int val, int shift) { 22 int rotl32(int val, int shift) {
25 var modShift = shift & 31; 23 var modShift = shift & 31;
26 return ((val << modShift) & mask32) | 24 return ((val << modShift) & mask32) |
27 ((val & mask32) >> (32 - modShift)); 25 ((val & mask32) >> (32 - modShift));
28 } 26 }
OLDNEW
« no previous file with comments | « lib/src/sha256.dart ('k') | test/hmac_sha1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698