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

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

Issue 1349373002: Improve the style of code in lib/. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Code review changes 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 | « lib/src/base64/encoder_sink.dart ('k') | lib/src/hash_base.dart » ('j') | 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 /// Utility methods for working with message digests. 9 /// Utility methods for working with message digests.
10 abstract class CryptoUtils { 10 abstract class CryptoUtils {
(...skipping 13 matching lines...) Expand all
24 /// 24 ///
25 /// The list can be any list of integers from 0 to 255 inclusive, for example 25 /// The list can be any list of integers from 0 to 255 inclusive, for example
26 /// a message digest. 26 /// a message digest.
27 /// 27 ///
28 /// If [addLineSeparator] is true, the resulting string will be 28 /// If [addLineSeparator] is true, the resulting string will be
29 /// broken into lines of 76 characters, separated by "\r\n". 29 /// broken into lines of 76 characters, separated by "\r\n".
30 /// 30 ///
31 /// If [urlSafe] is true, the resulting string will be URL- and filename- 31 /// If [urlSafe] is true, the resulting string will be URL- and filename-
32 /// safe. 32 /// safe.
33 static String bytesToBase64(List<int> bytes, 33 static String bytesToBase64(List<int> bytes,
34 {bool urlSafe: false, bool addLineSeparator: false}) { 34 {bool urlSafe: false, bool addLineSeparator: false}) =>
35 return BASE64.encode(bytes, 35 BASE64.encode(bytes,
36 urlSafe: urlSafe, addLineSeparator: addLineSeparator); 36 urlSafe: urlSafe, addLineSeparator: addLineSeparator);
37 }
38 37
39 /// Converts a [Base64-encoded][rfc] String into list of bytes. 38 /// Converts a [Base64-encoded][rfc] String into list of bytes.
40 /// 39 ///
41 /// [rfc]: https://tools.ietf.org/html/rfc4648 40 /// [rfc]: https://tools.ietf.org/html/rfc4648
42 /// 41 ///
43 /// This ignores "\r\n" sequences in [input]. It accepts both URL-safe and 42 /// This ignores "\r\n" sequences in [input]. It accepts both URL-safe and
44 /// -unsafe Base 64 encoded strings. 43 /// -unsafe Base 64 encoded strings.
45 /// 44 ///
46 /// Throws a [FormatException] if [input] contains invalid characters. 45 /// Throws a [FormatException] if [input] contains invalid characters.
47 static List<int> base64StringToBytes(String input) { 46 static List<int> base64StringToBytes(String input) => BASE64.decode(input);
48 return BASE64.decode(input);
49 }
50 } 47 }
OLDNEW
« no previous file with comments | « lib/src/base64/encoder_sink.dart ('k') | lib/src/hash_base.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698