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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « sdk/lib/core/strings.dart ('k') | sdk/lib/crypto/hash_utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/crypto/crypto.dart
diff --git a/sdk/lib/crypto/crypto.dart b/sdk/lib/crypto/crypto.dart
index ea4e8fee6af1daaf42627e4468205c0c3698bd06..590a62e9359a8a48651829795643364680611d0c 100644
--- a/sdk/lib/crypto/crypto.dart
+++ b/sdk/lib/crypto/crypto.dart
@@ -16,27 +16,28 @@ part 'sha256.dart';
/**
* Interface for cryptographic hash functions.
*
- * The [update] method is used to add data to the hash. The [digest] method
+ * The [add] method is used to add data to the hash. The [close] method
* is used to extract the message digest.
*
- * Once the [digest] method has been called no more data can be added using the
- * [update] method. If [update] is called after the first call to [digest] a
+ * Once the [close] method has been called no more data can be added using the
+ * [add] method. If [add] is called after the first call to [close] a
* HashException is thrown.
*
* If multiple instances of a given Hash is needed the [newInstance]
* method can provide a new instance.
*/
+// TODO(floitsch): make Hash implement Sink, StreamSink or similar.
abstract class Hash {
/**
* Add a list of bytes to the hash computation.
*/
- Hash update(List<int> data);
+ add(List<int> data);
/**
* Finish the hash computation and extract the message digest as
* a list of bytes.
*/
- List<int> digest();
+ List<int> close();
/**
* Returns a new instance of this hash function.
@@ -79,9 +80,10 @@ abstract class MD5 implements Hash {
/**
* Hash-based Message Authentication Code support.
*
- * The [update] method is used to add data to the message. The [digest] method
- * is used to extract the message authentication code.
+ * The [add] method is used to add data to the message. The [digest] and
+ * [close] methods are used to extract the message authentication code.
*/
+// TODO(floitsch): make Hash implement Sink, StreamSink or similar.
abstract class HMAC {
/**
* Create an [HMAC] object from a [Hash] and a key.
@@ -91,13 +93,18 @@ abstract class HMAC {
/**
* Add a list of bytes to the message.
*/
- HMAC update(List<int> data);
+ add(List<int> data);
/**
* Perform the actual computation and extract the message digest
* as a list of bytes.
*/
- List<int> digest();
+ List<int> close();
+
+ /**
+ * Extract the message digest as a list of bytes without closing [this].
+ */
+ List<int> get digest;
/**
* Verify that the HMAC computed for the data so far matches the
« no previous file with comments | « sdk/lib/core/strings.dart ('k') | sdk/lib/crypto/hash_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698