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

Side by Side Diff: packages/crypto/example/hash.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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 | « packages/crypto/codereview.settings ('k') | packages/crypto/lib/crypto.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2015, 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 'dart:async';
6 import 'dart:io';
7
8 import 'package:crypto/crypto.dart';
9
10 final _usage = 'Usage: dart hash.dart <md5|sha1|sha256> <input_filename>';
11
12 Future main(List<String> args) async {
13 if (args == null || args.length != 2) {
14 print(_usage);
15 exit(1);
16 }
17
18 Hash hasher;
19
20 switch (args[0]) {
21 case 'md5':
22 hasher = md5;
23 break;
24 case 'sha1':
25 hasher = sha1;
26 break;
27 case 'sha256':
28 hasher = sha256;
29 break;
30 default:
31 print(_usage);
32 exit(1);
33 }
34
35 var filename = args[1];
36 var input = new File(filename);
37
38 if (!input.existsSync()) {
39 print('File "$filename" does not exist.');
40 exit(1);
41 }
42
43 var value = await hasher.bind(input.openRead()).first;
44
45 print(value);
46 }
OLDNEW
« no previous file with comments | « packages/crypto/codereview.settings ('k') | packages/crypto/lib/crypto.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698