Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: lib/src/crypto_utils.dart

Issue 1346403004: Fix the signature for CryptoUtils.bytesToBase64. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.crypto_utils; 5 library crypto.crypto_utils;
6 6
7 import 'base64.dart'; 7 import 'base64.dart';
8 8
9 /** 9 /**
10 * Utility methods for working with message digests. 10 * Utility methods for working with message digests.
(...skipping 19 matching lines...) Expand all
30 * 30 *
31 * If [addLineSeparator] is true, the resulting string will be 31 * If [addLineSeparator] is true, the resulting string will be
32 * broken into lines of 76 characters, separated by "\r\n". 32 * broken into lines of 76 characters, separated by "\r\n".
33 * 33 *
34 * If [urlSafe] is true, the result is URL and filename safe. 34 * If [urlSafe] is true, the result is URL and filename safe.
35 * 35 *
36 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) 36 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648)
37 * 37 *
38 */ 38 */
39 static String bytesToBase64(List<int> bytes, 39 static String bytesToBase64(List<int> bytes,
40 [bool urlSafe = false, bool addLineSeparator = false]) { 40 {bool urlSafe: false, bool addLineSeparator: false}) {
41 return BASE64.encode(bytes, 41 return BASE64.encode(bytes,
42 urlSafe: urlSafe, addLineSeparator: addLineSeparator); 42 urlSafe: urlSafe, addLineSeparator: addLineSeparator);
43 } 43 }
44 44
45 /** 45 /**
46 * Converts a Base 64 encoded String into list of bytes. 46 * Converts a Base 64 encoded String into list of bytes.
47 * 47 *
48 * Decoder ignores "\r\n" sequences from input. 48 * Decoder ignores "\r\n" sequences from input.
49 * 49 *
50 * Accepts both URL safe and unsafe Base 64 encoded strings. 50 * Accepts both URL safe and unsafe Base 64 encoded strings.
51 * 51 *
52 * Throws a FormatException exception if input contains invalid characters. 52 * Throws a FormatException exception if input contains invalid characters.
53 * 53 *
54 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648) 54 * Based on [RFC 4648](http://tools.ietf.org/html/rfc4648)
55 */ 55 */
56 static List<int> base64StringToBytes(String input) { 56 static List<int> base64StringToBytes(String input) {
57 return BASE64.decode(input); 57 return BASE64.decode(input);
58 } 58 }
59 } 59 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698