OLD | NEW |
| (Empty) |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'base64.dart'; | |
6 | |
7 /// This class is deprecated. | |
8 @Deprecated("Will be removed in crypto 1.0.0.") | |
9 abstract class CryptoUtils { | |
10 /// This is deprecated. | |
11 /// | |
12 /// Use `hex` from `package:convert` instead. | |
13 static String bytesToHex(List<int> bytes) { | |
14 var result = new StringBuffer(); | |
15 for (var part in bytes) { | |
16 result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}'); | |
17 } | |
18 return result.toString(); | |
19 } | |
20 | |
21 /// This is deprecated. | |
22 /// | |
23 /// Use `BASE64` from `dart:convert` instead. | |
24 static String bytesToBase64(List<int> bytes, | |
25 {bool urlSafe: false, bool addLineSeparator: false}) => | |
26 BASE64.encode(bytes, | |
27 urlSafe: urlSafe, addLineSeparator: addLineSeparator); | |
28 | |
29 /// This is deprecated. | |
30 /// | |
31 /// Use `BASE64` from `dart:convert` instead. | |
32 static List<int> base64StringToBytes(String input) => BASE64.decode(input); | |
33 } | |
OLD | NEW |