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

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

Issue 1826543003: Update deprecations. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Created 4 years, 9 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/digest.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 import 'base64.dart'; 5 import 'base64.dart';
6 6
7 /// Utility methods for working with message digests. 7 /// This class is deprecated.
8 @Deprecated("Will be removed in crypto 1.0.0.")
8 abstract class CryptoUtils { 9 abstract class CryptoUtils {
9 /// Convert a list of bytes (for example a message digest) into a hexadecimal 10 /// This is deprecated.
10 /// string. 11 ///
12 /// Use `hex` from `package:convert` instead.
11 static String bytesToHex(List<int> bytes) { 13 static String bytesToHex(List<int> bytes) {
12 var result = new StringBuffer(); 14 var result = new StringBuffer();
13 for (var part in bytes) { 15 for (var part in bytes) {
14 result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}'); 16 result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
15 } 17 }
16 return result.toString(); 18 return result.toString();
17 } 19 }
18 20
19 /// Converts a list of bytes into a [Base64-encoded][rfc] string. 21 /// This is deprecated.
20 /// 22 ///
21 /// [rfc]: https://tools.ietf.org/html/rfc4648 23 /// Use `BASE64` from `dart:convert` instead.
22 ///
23 /// The list can be any list of integers from 0 to 255 inclusive, for example
24 /// a message digest.
25 ///
26 /// If [addLineSeparator] is true, the resulting string will be
27 /// broken into lines of 76 characters, separated by "\r\n".
28 ///
29 /// If [urlSafe] is true, the resulting string will be URL- and filename-
30 /// safe.
31 static String bytesToBase64(List<int> bytes, 24 static String bytesToBase64(List<int> bytes,
32 {bool urlSafe: false, bool addLineSeparator: false}) => 25 {bool urlSafe: false, bool addLineSeparator: false}) =>
33 BASE64.encode(bytes, 26 BASE64.encode(bytes,
34 urlSafe: urlSafe, addLineSeparator: addLineSeparator); 27 urlSafe: urlSafe, addLineSeparator: addLineSeparator);
35 28
36 /// Converts a [Base64-encoded][rfc] String into list of bytes. 29 /// This is deprecated.
37 /// 30 ///
38 /// [rfc]: https://tools.ietf.org/html/rfc4648 31 /// Use `BASE64` from `dart:convert` instead.
39 ///
40 /// This ignores "\r\n" sequences in [input]. It accepts both URL-safe and
41 /// -unsafe Base 64 encoded strings.
42 ///
43 /// Throws a [FormatException] if [input] contains invalid characters.
44 static List<int> base64StringToBytes(String input) => BASE64.decode(input); 32 static List<int> base64StringToBytes(String input) => BASE64.decode(input);
45 } 33 }
OLDNEW
« no previous file with comments | « lib/src/base64/encoder_sink.dart ('k') | lib/src/digest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698