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

Unified Diff: lib/crypto/crypto.dart

Issue 10383041: Add CryptoUtils class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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 | lib/crypto/crypto_utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/crypto/crypto.dart
diff --git a/lib/crypto/crypto.dart b/lib/crypto/crypto.dart
index f17c0f0e9c9c9d79aae83e3357eca9d592f381ae..ba4f61df7d74d6bc0e6de6c0d547177e49c87dee 100644
--- a/lib/crypto/crypto.dart
+++ b/lib/crypto/crypto.dart
@@ -4,6 +4,7 @@
#library('crypto');
+#source('crypto_utils.dart');
#source('hmac.dart');
#source('sha_utils.dart');
#source('sha1.dart');
@@ -59,7 +60,6 @@ interface SHA256 extends Hash default _SHA256 {
SHA256();
}
-
/**
* Hash-based Message Authentication Code support.
*
@@ -84,6 +84,18 @@ interface HMAC default _HMAC {
List<int> digest();
}
+/**
+ * Utility methods for working with message digests.
+ */
+class CryptoUtils {
+ /**
+ * Convert a message digest which is a list of bytes into a hex
+ * string.
+ */
+ static String digestToHex(List<int> digest) {
Søren Gjesse 2012/05/07 14:26:34 Shouldn't this just be bytesToHex? This can be use
Mads Ager (google) 2012/05/07 14:34:59 Good point. Done.
+ return _CryptoUtils.digestToHex(digest);
+ }
+}
/**
* HashExceptions are thrown on invalid use of a Hash
« no previous file with comments | « no previous file | lib/crypto/crypto_utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698