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

Unified Diff: tests/lib/crypto/sha256_test.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
« lib/crypto/crypto.dart ('K') | « tests/lib/crypto/sha1_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/crypto/sha256_test.dart
diff --git a/tests/lib/crypto/sha256_test.dart b/tests/lib/crypto/sha256_test.dart
index 588cc575f295c335be40c2b59a48b8e8b76363b9..fe99c4e5fc6647d9a679e55b9401efe95eb2a7b8 100644
--- a/tests/lib/crypto/sha256_test.dart
+++ b/tests/lib/crypto/sha256_test.dart
@@ -19,14 +19,6 @@ List<int> createTestArr(int len) {
return arr;
}
-String digestToString(List<int> digest) {
- var buf = new StringBuffer();
- for (var part in digest) {
- buf.add("${(part < 16) ? "0" : ""}${part.toRadixString(16).toLowerCase()}");
- }
- return buf.toString();
-}
-
void test() {
final expected_values = const [
'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
@@ -288,7 +280,7 @@ void test() {
for (var i = 0; i < expected_values.length; i++) {
var d = new SHA256().update(createTestArr(i)).digest();
- Expect.equals(expected_values[i], digestToString(d), '$i');
+ Expect.equals(expected_values[i], CryptoUtils.digestToHex(d), '$i');
}
}
@@ -307,7 +299,7 @@ void testRepeatedDigest() {
void testStandardVectors(inputs, mds) {
for (var i = 0; i < inputs.length; i++) {
var d = new SHA256().update(inputs[i]).digest();
- Expect.equals(mds[i], digestToString(d), '$i');
+ Expect.equals(mds[i], CryptoUtils.digestToHex(d), '$i');
}
}
« lib/crypto/crypto.dart ('K') | « tests/lib/crypto/sha1_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698