| 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 /** | 5 /** |
| 6 * Cryptographic algorithms, with support for hash functions such as | 6 * Cryptographic algorithms, with support for hash functions such as |
| 7 * SHA-1, SHA-256, HMAC, and MD5. | 7 * SHA-1, SHA-256, HMAC, and MD5. |
| 8 */ | 8 */ |
| 9 library crypto; | 9 library crypto; |
| 10 | 10 |
| 11 import 'dart:math'; | 11 import 'dart:math'; |
| 12 import 'dart:typed_data'; | 12 import 'dart:typed_data'; |
| 13 import 'dart:convert'; |
| 13 | 14 |
| 14 part 'src/crypto_utils.dart'; | 15 part 'src/crypto_utils.dart'; |
| 15 part 'src/hash_utils.dart'; | 16 part 'src/hash_utils.dart'; |
| 16 part 'src/hmac.dart'; | 17 part 'src/hmac.dart'; |
| 17 part 'src/md5.dart'; | 18 part 'src/md5.dart'; |
| 18 part 'src/sha1.dart'; | 19 part 'src/sha1.dart'; |
| 19 part 'src/sha256.dart'; | 20 part 'src/sha256.dart'; |
| 21 part 'src/base64.dart'; |
| 20 | 22 |
| 21 /** | 23 /** |
| 22 * Interface for cryptographic hash functions. | 24 * Interface for cryptographic hash functions. |
| 23 * | 25 * |
| 24 * The [add] method is used to add data to the hash. The [close] method | 26 * The [add] method is used to add data to the hash. The [close] method |
| 25 * is used to extract the message digest. | 27 * is used to extract the message digest. |
| 26 * | 28 * |
| 27 * Once the [close] method has been called no more data can be added using the | 29 * Once the [close] method has been called no more data can be added using the |
| 28 * [add] method. If [add] is called after the first call to [close] a | 30 * [add] method. If [add] is called after the first call to [close] a |
| 29 * HashException is thrown. | 31 * HashException is thrown. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 * Accepts both URL safe and unsafe Base 64 encoded strings. | 103 * Accepts both URL safe and unsafe Base 64 encoded strings. |
| 102 * | 104 * |
| 103 * Throws a FormatException exception if input contains invalid characters. | 105 * Throws a FormatException exception if input contains invalid characters. |
| 104 * | 106 * |
| 105 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) | 107 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
| 106 */ | 108 */ |
| 107 static List<int> base64StringToBytes(String input) { | 109 static List<int> base64StringToBytes(String input) { |
| 108 return _CryptoUtils.base64StringToBytes(input); | 110 return _CryptoUtils.base64StringToBytes(input); |
| 109 } | 111 } |
| 110 } | 112 } |
| OLD | NEW |