| 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 /** | 5 /** |
| 6 * SHA-1. | 6 * SHA-1. |
| 7 * Ripped from package:crypto. | 7 * Ripped from package:crypto. |
| 8 */ | 8 */ |
| 9 library sha1; | 9 library sha1; |
| 10 | 10 |
| 11 import 'dart:convert'; |
| 11 import 'dart:math' show pow; | 12 import 'dart:math' show pow; |
| 12 import 'dart:convert'; | |
| 13 | 13 |
| 14 import '../io/code_output.dart' show CodeOutputListener; | 14 import '../io/code_output.dart' show CodeOutputListener; |
| 15 | 15 |
| 16 class Hasher implements CodeOutputListener { | 16 class Hasher implements CodeOutputListener { |
| 17 Hash _hasher = new SHA1(); | 17 Hash _hasher = new SHA1(); |
| 18 String _hashString; | 18 String _hashString; |
| 19 | 19 |
| 20 @override | 20 @override |
| 21 void onDone(int length) { | 21 void onDone(int length) { |
| 22 // Do nothing. | 22 // Do nothing. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 int y = bytes[i + 1]; | 361 int y = bytes[i + 1]; |
| 362 out[j++] = lookup.codeUnitAt(x >> 2); | 362 out[j++] = lookup.codeUnitAt(x >> 2); |
| 363 out[j++] = lookup.codeUnitAt(((x << 4) | (y >> 4)) & 0x3F); | 363 out[j++] = lookup.codeUnitAt(((x << 4) | (y >> 4)) & 0x3F); |
| 364 out[j++] = lookup.codeUnitAt((y << 2) & 0x3F); | 364 out[j++] = lookup.codeUnitAt((y << 2) & 0x3F); |
| 365 out[j++] = PAD; | 365 out[j++] = PAD; |
| 366 } | 366 } |
| 367 | 367 |
| 368 return new String.fromCharCodes(out); | 368 return new String.fromCharCodes(out); |
| 369 } | 369 } |
| 370 } | 370 } |
| OLD | NEW |