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

Unified Diff: lib/src/web_socket/channel.dart

Issue 1823303002: Add support for crypto 1.0.0. (Closed) Base URL: git@github.com:dart-lang/http_parser@master
Patch Set: Created 4 years, 9 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 | « CHANGELOG.md ('k') | lib/src/web_socket/compatible.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/web_socket/channel.dart
diff --git a/lib/src/web_socket/channel.dart b/lib/src/web_socket/channel.dart
index fd1e3c5aae1dce0405683d6cdbc5503dfccaeb30..d2a6674e1d79af2d12a68716851613139c9ffbc5 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 @@ class WebSocketChannel extends StreamChannelMixin {
///
/// [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.
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/web_socket/compatible.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698