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

Unified Diff: lib/crypto/hmac.dart

Issue 10268007: Make sure to use a fresh hasher instance for all HMAC hashing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/crypto/hmac.dart
diff --git a/lib/crypto/hmac.dart b/lib/crypto/hmac.dart
index 923d281205b23d42a9d0c9ea5e054309aa35b561..c73bd8fec54e03bf95eef3b41e2282991d2d4d8c 100644
--- a/lib/crypto/hmac.dart
+++ b/lib/crypto/hmac.dart
@@ -15,8 +15,8 @@ class _HMAC implements HMAC {
// Hash the key if it is longer than the block size of the hash.
if (_key.length > blockSize) {
- _key = _hash.update(_key).digest();
_hash = _hash.newInstance();
+ _key = _hash.update(_key).digest();
}
// Zero-pad the key until its size is equal to the block size of the hash.
@@ -36,8 +36,8 @@ class _HMAC implements HMAC {
}
// Inner hash computation.
- var innerHash = _hash.update(padding).update(_message).digest();
_hash = _hash.newInstance();
+ var innerHash = _hash.update(padding).update(_message).digest();
// Compute outer padding.
for (var i = 0; i < blockSize; i++) {
@@ -45,6 +45,7 @@ class _HMAC implements HMAC {
}
// Outer hash computation which is the result.
+ _hash = _hash.newInstance();
return _hash.update(padding).update(innerHash).digest();
}
@@ -52,4 +53,4 @@ class _HMAC implements HMAC {
Hash _hash;
List<int> _key;
List<int> _message;
-}
+}
« 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