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

Unified Diff: lib/crypto/sha_utils.dart

Issue 10170027: Implement HMAC support in lib/crypto. (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
Index: lib/crypto/sha_utils.dart
diff --git a/lib/crypto/sha_utils.dart b/lib/crypto/sha_utils.dart
index 42aebae7d082ec00d08a94709c0e66184d488a15..ebc19b96c1f508d4e07bd8916243eca30457407a 100644
--- a/lib/crypto/sha_utils.dart
+++ b/lib/crypto/sha_utils.dart
@@ -10,7 +10,7 @@ final _BYTES_PER_WORD = 4;
// Base class encapsulating common behavior for SHA cryptographic hash
// functions.
-class _SHACryptoHashBase implements CryptoHash {
+class _SHACryptoHashBase {
Ben Laurie (Google) 2012/04/27 13:26:33 Why no longer implements CryptoHash?
Mads Ager (google) 2012/04/30 07:56:57 Because it doesn't. It does not have the newInstan
_SHACryptoHashBase(int this._chunkSizeInWords, int this._digestSizeInWords)
: _pendingData = [] {
_currentChunk = new List(_chunkSizeInWords);
@@ -46,6 +46,11 @@ class _SHACryptoHashBase implements CryptoHash {
return result;
}
+ // Returns the block size of the hash in bytes.
+ int get blockSize() {
+ return _chunkSizeInWords * _BYTES_PER_WORD;
+ }
+
// One round of the hash computation.
abstract _updateHash(List<int> m);
@@ -108,9 +113,9 @@ class _SHACryptoHashBase implements CryptoHash {
}
// Hasher state.
+ final int _chunkSizeInWords;
+ final int _digestSizeInWords;
int _lengthInBytes = 0;
- int _chunkSizeInWords;
- int _digestSizeInWords;
List<int> _pendingData;
List<int> _currentChunk;
List<int> _h;

Powered by Google App Engine
This is Rietveld 408576698