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

Unified Diff: tools/addlatexhash.dart

Issue 1890973003: pkg/analyzer: support latest pkg/crypto version (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: nits Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/web_socket_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/addlatexhash.dart
diff --git a/tools/addlatexhash.dart b/tools/addlatexhash.dart
index a8872d54c8934644d18c2d9b1f25b7e0fa70087b..48e655c7d339d024b95a1727d55e382e93baef77 100755
--- a/tools/addlatexhash.dart
+++ b/tools/addlatexhash.dart
@@ -11,7 +11,9 @@
// hash listing file name as the third argument. From docs/language a
// typical usage would be as follows:
//
-// dart ../../tools/addlatexhash.dart dartLangSpec.tex out.tex hash.txt
+// dart
+// --package-root=<build dir>/packages \
+// ../../tools/addlatexhash.dart dartLangSpec.tex out.tex hash.txt
//
// This will produce a normalized variant out.tex of the language
// specification with hash values filled in, and a listing hash.txt of
@@ -24,8 +26,10 @@
import 'dart:io';
import 'dart:convert';
-import '../third_party/pkg/utf/lib/utf.dart';
-import '../third_party/pkg/crypto/lib/crypto.dart';
+
+import 'package:crypto/crypto.dart';
+import 'package:convert/convert.dart';
+import 'package:utf/utf.dart';
// ----------------------------------------------------------------------
// Normalization of the text: removal or normalization of parts that
@@ -484,16 +488,15 @@ gatherLines(lines, startIndex, nextIndex) =>
/// in [lines], stopping just before [nextIndex]. SIDE EFFECT:
/// Outputs the simplified text and its hash value to [listSink].
computeHashValue(lines, startIndex, nextIndex, listSink) {
- final hashEncoder = new SHA1();
final gatheredLine = gatherLines(lines, startIndex, nextIndex);
final simplifiedLine = simplifyLine(gatheredLine);
listSink.write(" % $simplifiedLine\n");
- hashEncoder.add(encodeUtf8(simplifiedLine));
- return hashEncoder.close();
+ var digest = sha1.convert(encodeUtf8(simplifiedLine));
+ return digest.bytes;
}
computeHashString(lines, startIndex, nextIndex, listSink) =>
- CryptoUtils.bytesToHex(computeHashValue(lines,
+ hex.encode(computeHashValue(lines,
startIndex,
nextIndex,
listSink));
« no previous file with comments | « tests/standalone/io/web_socket_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698