Port to crypto 0.9.2

This commit is contained in:
Ian Hickson
2016-03-22 21:14:34 -07:00
parent cae847dc98
commit 87eb34240b
4 changed files with 13 additions and 10 deletions

View File

@@ -7,10 +7,15 @@ import 'dart:io';
import 'package:crypto/crypto.dart';
String hex(List<int> bytes) {
StringBuffer result = new StringBuffer();
for (int part in bytes)
result.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
return result.toString();
}
String calculateSha(File file) {
SHA1 sha1 = new SHA1();
sha1.add(file.readAsBytesSync());
return CryptoUtils.bytesToHex(sha1.close());
return hex(sha1.convert(file.readAsBytesSync()).bytes);
}
/// Convert `foo_bar` to `fooBar`.

View File

@@ -11,7 +11,7 @@ dependencies:
analyzer: '>=0.26.1+17' # see note below
archive: ^1.0.20
args: ^0.13.4
crypto: ^0.9.1
crypto: ^0.9.2
den_api: ^0.1.0
file: ^0.1.0
mustache4dart: ^1.0.0