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

Side by Side Diff: sdk/lib/io/crypto.dart

Issue 15974005: Fix use of HashException in dart:io (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of dart.io; 5 part of dart.io;
6 6
7 class _CryptoUtils { 7 class _CryptoUtils {
8 static String bytesToHex(List<int> bytes) { 8 static String bytesToHex(List<int> bytes) {
9 var result = new StringBuffer(); 9 var result = new StringBuffer();
10 for (var part in bytes) { 10 for (var part in bytes) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 int this._digestSizeInWords, 173 int this._digestSizeInWords,
174 bool this._bigEndianWords) 174 bool this._bigEndianWords)
175 : _pendingData = [] { 175 : _pendingData = [] {
176 _currentChunk = new List(_chunkSizeInWords); 176 _currentChunk = new List(_chunkSizeInWords);
177 _h = new List(_digestSizeInWords); 177 _h = new List(_digestSizeInWords);
178 } 178 }
179 179
180 // Update the hasher with more data. 180 // Update the hasher with more data.
181 add(List<int> data) { 181 add(List<int> data) {
182 if (_digestCalled) { 182 if (_digestCalled) {
183 throw new ArgumentError( 183 throw new StateError(
184 'Hash update method called after digest was retrieved'); 184 'Hash update method called after digest was retrieved');
185 } 185 }
186 _lengthInBytes += data.length; 186 _lengthInBytes += data.length;
187 _pendingData.addAll(data); 187 _pendingData.addAll(data);
188 _iterate(); 188 _iterate();
189 } 189 }
190 190
191 // Finish the hash computation and return the digest string. 191 // Finish the hash computation and return the digest string.
192 List<int> close() { 192 List<int> close() {
193 if (_digestCalled) { 193 if (_digestCalled) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 _h[0] = _add32(a, _h[0]); 440 _h[0] = _add32(a, _h[0]);
441 _h[1] = _add32(b, _h[1]); 441 _h[1] = _add32(b, _h[1]);
442 _h[2] = _add32(c, _h[2]); 442 _h[2] = _add32(c, _h[2]);
443 _h[3] = _add32(d, _h[3]); 443 _h[3] = _add32(d, _h[3]);
444 _h[4] = _add32(e, _h[4]); 444 _h[4] = _add32(e, _h[4]);
445 } 445 }
446 446
447 List<int> _w; 447 List<int> _w;
448 } 448 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698