Add support for crypto 1.0.0.

R=kevmoo@google.com

Review URL: https://codereview.chromium.org//1823303002 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 341ba0b..bb1b79e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.2.1
+
+* Add support for `crypto` 1.0.0.
+
 ## 2.2.0
 
 * `WebSocketChannel` has been moved to
diff --git a/lib/src/web_socket/channel.dart b/lib/src/web_socket/channel.dart
index fd1e3c5..d2a6674 100644
--- a/lib/src/web_socket/channel.dart
+++ b/lib/src/web_socket/channel.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
+import 'dart:convert';
 
 import 'package:async/async.dart';
 import 'package:crypto/crypto.dart';
@@ -68,11 +69,9 @@
   ///
   /// [initial handshake]: https://tools.ietf.org/html/rfc6455#section-4.2.2
   static String signKey(String key) {
-    var hash = new SHA1();
     // We use [codeUnits] here rather than UTF-8-decoding the string because
     // [key] is expected to be base64 encoded, and so will be pure ASCII.
-    hash.add((key + webSocketGUID).codeUnits);
-    return CryptoUtils.bytesToBase64(hash.close());
+    return BASE64.encode(sha1.convert((key + webSocketGUID).codeUnits).bytes);
   }
 
   /// Creates a new WebSocket handling messaging across an existing socket.
diff --git a/lib/src/web_socket/compatible.dart b/lib/src/web_socket/compatible.dart
index 35e7d0e..862f6d6 100644
--- a/lib/src/web_socket/compatible.dart
+++ b/lib/src/web_socket/compatible.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:async';
+import 'dart:convert';
 
 import 'package:crypto/crypto.dart';
 
@@ -51,11 +52,9 @@
   ///
   /// [initial handshake]: https://tools.ietf.org/html/rfc6455#section-4.2.2
   static String signKey(String key) {
-    var hash = new SHA1();
     // We use [codeUnits] here rather than UTF-8-decoding the string because
     // [key] is expected to be base64 encoded, and so will be pure ASCII.
-    hash.add((key + webSocketGUID).codeUnits);
-    return CryptoUtils.bytesToBase64(hash.close());
+    return BASE64.encode(sha1.convert((key + webSocketGUID).codeUnits).bytes);
   }
 
   /// Creates a new WebSocket handling messaging across an existing socket.
diff --git a/pubspec.yaml b/pubspec.yaml
index a572172..804d951 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
 name: http_parser
-version: 2.2.0
+version: 2.2.1
 author: "Dart Team <misc@dartlang.org>"
 homepage: https://github.com/dart-lang/http_parser
 description: >
@@ -7,7 +7,7 @@
 dependencies:
   async: "^1.3.0"
   collection: ">=0.9.1 <2.0.0"
-  crypto: "^0.9.0"
+  crypto: ">=0.9.2 <2.0.0"
   source_span: "^1.0.0"
   stream_channel: "^1.0.0"
   string_scanner: ">=0.0.0 <0.2.0"