| OLD | NEW |
| 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 #library('crypto'); | 5 #library('crypto'); |
| 6 | 6 |
| 7 #source('crypto_utils.dart'); | 7 #source('crypto_utils.dart'); |
| 8 #source('hash_utils.dart'); | 8 #source('hash_utils.dart'); |
| 9 #source('hmac.dart'); | 9 #source('hmac.dart'); |
| 10 #source('md5.dart'); | 10 #source('md5.dart'); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 * Utility methods for working with message digests. | 99 * Utility methods for working with message digests. |
| 100 */ | 100 */ |
| 101 class CryptoUtils { | 101 class CryptoUtils { |
| 102 /** | 102 /** |
| 103 * Convert a list of bytes (for example a message digest) into a hex | 103 * Convert a list of bytes (for example a message digest) into a hex |
| 104 * string. | 104 * string. |
| 105 */ | 105 */ |
| 106 static String bytesToHex(List<int> bytes) { | 106 static String bytesToHex(List<int> bytes) { |
| 107 return _CryptoUtils.bytesToHex(bytes); | 107 return _CryptoUtils.bytesToHex(bytes); |
| 108 } | 108 } |
| 109 |
| 110 /** |
| 111 * Converts a list of bytes (for example a message digest) into a |
| 112 * base64 encoded string optionally broken up in to lines of |
| 113 * [lineLength] chars separated by '\r\n'. |
| 114 */ |
| 115 static String bytesToBase64(List<int> bytes, [int lineLength]) { |
| 116 return _CryptoUtils.bytesToBase64(bytes, lineLength); |
| 117 } |
| 109 } | 118 } |
| 110 | 119 |
| 111 /** | 120 /** |
| 112 * HashExceptions are thrown on invalid use of a Hash | 121 * HashExceptions are thrown on invalid use of a Hash |
| 113 * object. | 122 * object. |
| 114 */ | 123 */ |
| 115 class HashException { | 124 class HashException { |
| 116 HashException(String this.message); | 125 HashException(String this.message); |
| 117 toString() => "HashException: $message"; | 126 toString() => "HashException: $message"; |
| 118 String message; | 127 String message; |
| 119 } | 128 } |
| 120 | 129 |
| OLD | NEW |