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

Side by Side Diff: lib/crypto/crypto_vm.dart

Issue 10456028: Add base 64 encoding to the crypto library utils. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // TODO(ager, iposva): Get rid of this file when the VM snapshot 5 // TODO(ager, iposva): Get rid of this file when the VM snapshot
6 // generation can deal with normal library structure. 6 // generation can deal with normal library structure.
7 7
8 #library('crypto'); 8 #library('crypto');
9 9
10 /** 10 /**
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * Utility methods for working with message digests. 95 * Utility methods for working with message digests.
96 */ 96 */
97 class CryptoUtils { 97 class CryptoUtils {
98 /** 98 /**
99 * Convert a list of bytes (for example a message digest) into a hex 99 * Convert a list of bytes (for example a message digest) into a hex
100 * string. 100 * string.
101 */ 101 */
102 static String bytesToHex(List<int> bytes) { 102 static String bytesToHex(List<int> bytes) {
103 return _CryptoUtils.bytesToHex(bytes); 103 return _CryptoUtils.bytesToHex(bytes);
104 } 104 }
105
106 /**
107 * Converts a list of bytes (for example a message digest) into a
108 * base64 encoded string.
109 */
110 static String bytesToBase64(List<int> bytes) {
111 return _CryptoUtils.bytesToBase64(bytes);
112 }
105 } 113 }
106 114
107 /** 115 /**
108 * HashExceptions are thrown on invalid use of a Hash 116 * HashExceptions are thrown on invalid use of a Hash
109 * object. 117 * object.
110 */ 118 */
111 class HashException { 119 class HashException {
112 HashException(String this.message); 120 HashException(String this.message);
113 toString() => "HashException: $message"; 121 toString() => "HashException: $message";
114 String message; 122 String message;
115 } 123 }
116 124
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698