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 part of dart.crypto; | 5 part of crypto; |
6 | 6 |
7 abstract class _CryptoUtils { | 7 abstract class _CryptoUtils { |
8 static String bytesToHex(List<int> bytes) { | 8 static String bytesToHex(List<int> bytes) { |
9 var result = new StringBuffer(); | 9 var result = new StringBuffer(); |
10 for (var part in bytes) { | 10 for (var part in bytes) { |
11 result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}'); | 11 result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}'); |
12 } | 12 } |
13 return result.toString(); | 13 return result.toString(); |
14 } | 14 } |
15 | 15 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 out[o++] = x >> 16; | 152 out[o++] = x >> 16; |
153 if (o < outputLen) { | 153 if (o < outputLen) { |
154 out[o++] = (x >> 8) & 0xFF; | 154 out[o++] = (x >> 8) & 0xFF; |
155 if (o < outputLen) out[o++] = x & 0xFF; | 155 if (o < outputLen) out[o++] = x & 0xFF; |
156 } | 156 } |
157 } | 157 } |
158 return out; | 158 return out; |
159 } | 159 } |
160 | 160 |
161 } | 161 } |
OLD | NEW |