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 | |
|
Lasse Reichstein Nielsen
2015/05/29 14:15:41
Extra line doesn't belong here.
Alexander Ivanov
2015/06/03 09:14:57
Done.
| |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 3 // 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. | 4 // BSD-style license that can be found in the LICENSE file. |
| 4 | 5 |
| 5 /** | 6 /** |
| 6 * Cryptographic algorithms, with support for hash functions such as | 7 * Cryptographic algorithms, with support for hash functions such as |
| 7 * SHA-1, SHA-256, HMAC, and MD5. | 8 * SHA-1, SHA-256, HMAC, and MD5. |
| 8 */ | 9 */ |
| 9 library crypto; | 10 library crypto; |
| 10 | 11 |
| 11 import 'dart:math'; | 12 import 'dart:math'; |
| 12 import 'dart:typed_data'; | 13 import 'dart:typed_data'; |
| 14 import 'dart:convert'; | |
| 13 | 15 |
| 14 part 'src/crypto_utils.dart'; | 16 part 'src/crypto_utils.dart'; |
| 15 part 'src/hash_utils.dart'; | 17 part 'src/hash_utils.dart'; |
| 16 part 'src/hmac.dart'; | 18 part 'src/hmac.dart'; |
| 17 part 'src/md5.dart'; | 19 part 'src/md5.dart'; |
| 18 part 'src/sha1.dart'; | 20 part 'src/sha1.dart'; |
| 19 part 'src/sha256.dart'; | 21 part 'src/sha256.dart'; |
| 22 part 'src/base64.dart'; | |
| 20 | 23 |
| 21 /** | 24 /** |
| 22 * Interface for cryptographic hash functions. | 25 * Interface for cryptographic hash functions. |
| 23 * | 26 * |
| 24 * The [add] method is used to add data to the hash. The [close] method | 27 * The [add] method is used to add data to the hash. The [close] method |
| 25 * is used to extract the message digest. | 28 * is used to extract the message digest. |
| 26 * | 29 * |
| 27 * Once the [close] method has been called no more data can be added using the | 30 * 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 | 31 * [add] method. If [add] is called after the first call to [close] a |
| 29 * HashException is thrown. | 32 * 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. | 104 * Accepts both URL safe and unsafe Base 64 encoded strings. |
| 102 * | 105 * |
| 103 * Throws a FormatException exception if input contains invalid characters. | 106 * Throws a FormatException exception if input contains invalid characters. |
| 104 * | 107 * |
| 105 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) | 108 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
| 106 */ | 109 */ |
| 107 static List<int> base64StringToBytes(String input) { | 110 static List<int> base64StringToBytes(String input) { |
| 108 return _CryptoUtils.base64StringToBytes(input); | 111 return _CryptoUtils.base64StringToBytes(input); |
| 109 } | 112 } |
| 110 } | 113 } |
| OLD | NEW |