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

Unified Diff: sdk/lib/io/crypto.dart

Issue 124753002: Code cleanup (mostly io lib and some http lib). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/crypto.dart
diff --git a/sdk/lib/io/crypto.dart b/sdk/lib/io/crypto.dart
index 35bd01cc6276de3833f0ebcb8d545df4a2036003..82cff5e5721282d7545afd5cc0053b9a5e8efb88 100644
--- a/sdk/lib/io/crypto.dart
+++ b/sdk/lib/io/crypto.dart
@@ -5,14 +5,6 @@
part of dart.io;
class _CryptoUtils {
- static String bytesToHex(List<int> bytes) {
- var result = new StringBuffer();
- for (var part in bytes) {
- result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
- }
- return result.toString();
- }
-
static const int PAD = 61; // '='
static const int CR = 13; // '\r'
static const int LF = 10; // '\n'
@@ -47,6 +39,14 @@ class _CryptoUtils {
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2,
-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2 ];
+ static String bytesToHex(List<int> bytes) {
+ var result = new StringBuffer();
+ for (var part in bytes) {
+ result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
+ }
+ return result.toString();
+ }
+
static String bytesToBase64(List<int> bytes,
[bool urlSafe = false,
bool addLineSeparator = false]) {
@@ -169,9 +169,19 @@ const _BYTES_PER_WORD = 4;
// Base class encapsulating common behavior for cryptographic hash
// functions.
abstract class _HashBase {
- _HashBase(int this._chunkSizeInWords,
- int this._digestSizeInWords,
- bool this._bigEndianWords)
+ // Hasher state.
+ final int _chunkSizeInWords;
+ final int _digestSizeInWords;
+ final bool _bigEndianWords;
+ int _lengthInBytes = 0;
+ List<int> _pendingData;
+ List<int> _currentChunk;
+ List<int> _h;
+ bool _digestCalled = false;
+
+ _HashBase(this._chunkSizeInWords,
+ this._digestSizeInWords,
+ this._bigEndianWords)
: _pendingData = [] {
_currentChunk = new List(_chunkSizeInWords);
_h = new List(_digestSizeInWords);
@@ -296,16 +306,6 @@ abstract class _HashBase {
_pendingData.addAll(_wordToBytes(0));
}
}
-
- // Hasher state.
- final int _chunkSizeInWords;
- final int _digestSizeInWords;
- final bool _bigEndianWords;
- int _lengthInBytes = 0;
- List<int> _pendingData;
- List<int> _currentChunk;
- List<int> _h;
- bool _digestCalled = false;
}
// The MD5 hasher is used to compute an MD5 message digest.
« no previous file with comments | « sdk/lib/io/common.dart ('k') | sdk/lib/io/directory.dart » ('j') | sdk/lib/io/http_date.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698