Chromium Code Reviews| 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('hash_utils.dart'); | |
| 7 #source('hmac.dart'); | 8 #source('hmac.dart'); |
| 8 #source('sha_utils.dart'); | 9 #source('md5.dart'); |
| 9 #source('sha1.dart'); | 10 #source('sha1.dart'); |
| 10 #source('sha256.dart'); | 11 #source('sha256.dart'); |
| 11 | 12 |
| 12 /** | 13 /** |
| 13 * Interface for cryptographic hash functions. | 14 * Interface for cryptographic hash functions. |
| 14 * | 15 * |
| 15 * The [update] method is used to add data to the hash. The [digest] method | 16 * The [update] method is used to add data to the hash. The [digest] method |
| 16 * is used to extract the message digest. | 17 * is used to extract the message digest. |
| 17 * | 18 * |
| 18 * Once the [digest] method has been called no more data can be added using the | 19 * Once the [digest] method has been called no more data can be added using the |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 39 */ | 40 */ |
| 40 Hash newInstance(); | 41 Hash newInstance(); |
| 41 | 42 |
| 42 /** | 43 /** |
| 43 * Block size of the hash in bytes. | 44 * Block size of the hash in bytes. |
| 44 */ | 45 */ |
| 45 int get blockSize(); | 46 int get blockSize(); |
| 46 } | 47 } |
| 47 | 48 |
| 48 /** | 49 /** |
| 50 * MD5 hash function implementation. | |
|
Søren Gjesse
2012/05/03 13:31:12
We could mention the issues with MD5 here.
Mads Ager (google)
2012/05/08 08:32:37
Done.
| |
| 51 */ | |
| 52 interface MD5 extends Hash default _MD5 { | |
| 53 MD5(); | |
| 54 } | |
| 55 | |
| 56 /** | |
| 49 * SHA1 hash function implementation. | 57 * SHA1 hash function implementation. |
| 50 */ | 58 */ |
| 51 interface SHA1 extends Hash default _SHA1 { | 59 interface SHA1 extends Hash default _SHA1 { |
| 52 SHA1(); | 60 SHA1(); |
| 53 } | 61 } |
| 54 | 62 |
| 55 /** | 63 /** |
| 56 * SHA256 hash function implementation. | 64 * SHA256 hash function implementation. |
| 57 */ | 65 */ |
| 58 interface SHA256 extends Hash default _SHA256 { | 66 interface SHA256 extends Hash default _SHA256 { |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 88 /** | 96 /** |
| 89 * HashExceptions are thrown on invalid use of a Hash | 97 * HashExceptions are thrown on invalid use of a Hash |
| 90 * object. | 98 * object. |
| 91 */ | 99 */ |
| 92 class HashException { | 100 class HashException { |
| 93 HashException(String this.message); | 101 HashException(String this.message); |
| 94 toString() => "HashException: $message"; | 102 toString() => "HashException: $message"; |
| 95 String message; | 103 String message; |
| 96 } | 104 } |
| 97 | 105 |
| OLD | NEW |