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

Unified Diff: pkg/compiler/lib/src/hash/sha1.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/helpers/debug_collection.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/hash/sha1.dart
diff --git a/pkg/compiler/lib/src/hash/sha1.dart b/pkg/compiler/lib/src/hash/sha1.dart
index 02eae83ce9121e5e16dc2b27c05f2a3e03aa0700..8e5eec2ef3fdf5e458f87dd769e086efb1d39d4a 100644
--- a/pkg/compiler/lib/src/hash/sha1.dart
+++ b/pkg/compiler/lib/src/hash/sha1.dart
@@ -54,15 +54,11 @@ class Hasher implements CodeOutputListener {
*
*/
String _bytesToBase64(List<int> bytes,
- {bool urlSafe : false,
- bool addLineSeparator : false}) {
- return _CryptoUtils.bytesToBase64(bytes,
- urlSafe,
- addLineSeparator);
+ {bool urlSafe: false, bool addLineSeparator: false}) {
+ return _CryptoUtils.bytesToBase64(bytes, urlSafe, addLineSeparator);
}
}
-
// Constants.
const _MASK_8 = 0xff;
const _MASK_32 = 0xffffffff;
@@ -73,9 +69,9 @@ const _BYTES_PER_WORD = 4;
// Rotate left limiting to unsigned 32-bit values.
int _rotl32(int val, int shift) {
-var mod_shift = shift & 31;
-return ((val << mod_shift) & _MASK_32) |
- ((val & _MASK_32) >> (32 - mod_shift));
+ var mod_shift = shift & 31;
+ return ((val << mod_shift) & _MASK_32) |
+ ((val & _MASK_32) >> (32 - mod_shift));
}
// Base class encapsulating common behavior for cryptographic hash
@@ -90,9 +86,8 @@ abstract class _HashBase implements Hash {
List<int> _pendingData;
bool _digestCalled = false;
- _HashBase(int chunkSizeInWords,
- int digestSizeInWords,
- bool this._bigEndianWords)
+ _HashBase(
+ int chunkSizeInWords, int digestSizeInWords, bool this._bigEndianWords)
: _pendingData = [],
_currentChunk = new List(chunkSizeInWords),
_h = new List(digestSizeInWords),
@@ -101,13 +96,13 @@ abstract class _HashBase implements Hash {
// Update the hasher with more data.
void add(List<int> data) {
- if (_digestCalled) {
- throw new StateError(
- 'Hash update method called after digest was retrieved');
- }
- _lengthInBytes += data.length;
- _pendingData.addAll(data);
- _iterate();
+ if (_digestCalled) {
+ throw new StateError(
+ 'Hash update method called after digest was retrieved');
+ }
+ _lengthInBytes += data.length;
+ _pendingData.addAll(data);
+ _iterate();
}
// Finish the hash computation and return the digest string.
@@ -124,7 +119,7 @@ abstract class _HashBase implements Hash {
// Returns the block size of the hash in bytes.
int get blockSize {
- return _chunkSizeInWords * _BYTES_PER_WORD;
+ return _chunkSizeInWords * _BYTES_PER_WORD;
}
// One round of the hash computation.
@@ -209,7 +204,6 @@ abstract class _HashBase implements Hash {
}
}
-
/**
* Interface for cryptographic hash functions.
*
@@ -252,7 +246,9 @@ class SHA1 extends _HashBase {
final List<int> _w;
// Construct a SHA1 hasher object.
- SHA1() : _w = new List(80), super(16, 5, true) {
+ SHA1()
+ : _w = new List(80),
+ super(16, 5, true) {
_h[0] = 0x67452301;
_h[1] = 0xEFCDAB89;
_h[2] = 0x98BADCFE;
@@ -305,10 +301,9 @@ class SHA1 extends _HashBase {
}
abstract class _CryptoUtils {
-
static const int PAD = 61; // '='
- static const int CR = 13; // '\r'
- static const int LF = 10; // '\n'
+ static const int CR = 13; // '\r'
+ static const int LF = 10; // '\n'
static const int LINE_LENGTH = 76;
static const String _encodeTable =
@@ -318,8 +313,7 @@ abstract class _CryptoUtils {
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
static String bytesToBase64(List<int> bytes,
- [bool urlSafe = false,
- bool addLineSeparator = false]) {
+ [bool urlSafe = false, bool addLineSeparator = false]) {
int len = bytes.length;
if (len == 0) {
return "";
@@ -340,11 +334,11 @@ abstract class _CryptoUtils {
int j = 0, i = 0, c = 0;
while (i < chunkLength) {
int x = ((bytes[i++] << 16) & 0xFFFFFF) |
- ((bytes[i++] << 8) & 0xFFFFFF) |
- bytes[i++];
+ ((bytes[i++] << 8) & 0xFFFFFF) |
+ bytes[i++];
out[j++] = lookup.codeUnitAt(x >> 18);
out[j++] = lookup.codeUnitAt((x >> 12) & 0x3F);
- out[j++] = lookup.codeUnitAt((x >> 6) & 0x3F);
+ out[j++] = lookup.codeUnitAt((x >> 6) & 0x3F);
out[j++] = lookup.codeUnitAt(x & 0x3f);
// Add optional line separator for each 76 char output.
if (addLineSeparator && ++c == 19 && j < outputLen - 2) {
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/helpers/debug_collection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698