| 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('hmac.dart'); | 9 #source('hmac.dart'); |
| 9 #source('sha_utils.dart'); | 10 #source('md5.dart'); |
| 10 #source('sha1.dart'); | 11 #source('sha1.dart'); |
| 11 #source('sha256.dart'); | 12 #source('sha256.dart'); |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Interface for cryptographic hash functions. | 15 * Interface for cryptographic hash functions. |
| 15 * | 16 * |
| 16 * The [update] method is used to add data to the hash. The [digest] method | 17 * The [update] method is used to add data to the hash. The [digest] method |
| 17 * is used to extract the message digest. | 18 * is used to extract the message digest. |
| 18 * | 19 * |
| 19 * Once the [digest] method has been called no more data can be added using the | 20 * Once the [digest] method has been called no more data can be added using the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 55 } |
| 55 | 56 |
| 56 /** | 57 /** |
| 57 * SHA256 hash function implementation. | 58 * SHA256 hash function implementation. |
| 58 */ | 59 */ |
| 59 interface SHA256 extends Hash default _SHA256 { | 60 interface SHA256 extends Hash default _SHA256 { |
| 60 SHA256(); | 61 SHA256(); |
| 61 } | 62 } |
| 62 | 63 |
| 63 /** | 64 /** |
| 65 * MD5 hash function implementation. |
| 66 * |
| 67 * WARNING: MD5 has known collisions and should only be used when |
| 68 * required for backwards compatibility. |
| 69 */ |
| 70 interface MD5 extends Hash default _MD5 { |
| 71 MD5(); |
| 72 } |
| 73 |
| 74 /** |
| 64 * Hash-based Message Authentication Code support. | 75 * Hash-based Message Authentication Code support. |
| 65 * | 76 * |
| 66 * The [update] method is used to add data to the message. The [digest] method | 77 * The [update] method is used to add data to the message. The [digest] method |
| 67 * is used to extract the message authentication code. | 78 * is used to extract the message authentication code. |
| 68 */ | 79 */ |
| 69 interface HMAC default _HMAC { | 80 interface HMAC default _HMAC { |
| 70 /** | 81 /** |
| 71 * Create an [HMAC] object from a [Hash] and a key. | 82 * Create an [HMAC] object from a [Hash] and a key. |
| 72 */ | 83 */ |
| 73 HMAC(Hash hash, List<int> key); | 84 HMAC(Hash hash, List<int> key); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 100 /** | 111 /** |
| 101 * HashExceptions are thrown on invalid use of a Hash | 112 * HashExceptions are thrown on invalid use of a Hash |
| 102 * object. | 113 * object. |
| 103 */ | 114 */ |
| 104 class HashException { | 115 class HashException { |
| 105 HashException(String this.message); | 116 HashException(String this.message); |
| 106 toString() => "HashException: $message"; | 117 toString() => "HashException: $message"; |
| 107 String message; | 118 String message; |
| 108 } | 119 } |
| 109 | 120 |
| OLD | NEW |