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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 * | 80 * |
81 * If [addLineSeparator] is true, the resulting string will be | 81 * If [addLineSeparator] is true, the resulting string will be |
82 * broken into lines of 76 characters, separated by "\r\n". | 82 * broken into lines of 76 characters, separated by "\r\n". |
83 * | 83 * |
84 * If [urlSafe] is true, the result is URL and filename safe. | 84 * If [urlSafe] is true, the result is URL and filename safe. |
85 * | 85 * |
86 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) | 86 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
87 * | 87 * |
88 */ | 88 */ |
89 static String bytesToBase64(List<int> bytes, | 89 static String bytesToBase64(List<int> bytes, |
90 {bool urlSafe : false, | 90 {bool urlSafe: false, bool addLineSeparator: false}) { |
91 bool addLineSeparator : false}) { | 91 return _CryptoUtils.bytesToBase64(bytes, urlSafe, addLineSeparator); |
92 return _CryptoUtils.bytesToBase64(bytes, | |
93 urlSafe, | |
94 addLineSeparator); | |
95 } | 92 } |
96 | 93 |
97 | |
98 /** | 94 /** |
99 * Converts a Base 64 encoded String into list of bytes. | 95 * Converts a Base 64 encoded String into list of bytes. |
100 * | 96 * |
101 * Decoder ignores "\r\n" sequences from input. | 97 * Decoder ignores "\r\n" sequences from input. |
102 * | 98 * |
103 * Accepts both URL safe and unsafe Base 64 encoded strings. | 99 * Accepts both URL safe and unsafe Base 64 encoded strings. |
104 * | 100 * |
105 * Throws a FormatException exception if input contains invalid characters. | 101 * Throws a FormatException exception if input contains invalid characters. |
106 * | 102 * |
107 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) | 103 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) |
108 */ | 104 */ |
109 static List<int> base64StringToBytes(String input) { | 105 static List<int> base64StringToBytes(String input) { |
110 return _CryptoUtils.base64StringToBytes(input); | 106 return _CryptoUtils.base64StringToBytes(input); |
111 } | 107 } |
112 } | 108 } |
OLD | NEW |