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

Unified Diff: runtime/bin/websocket_impl.dart

Issue 10398010: Remove the SHA1 implementation used by web sockets and use the dart:crypto library one instead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Additional changes to make all tests run Created 8 years, 7 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 | « runtime/bin/sha1.dart ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/websocket_impl.dart
diff --git a/runtime/bin/websocket_impl.dart b/runtime/bin/websocket_impl.dart
index c7f56edac2133962c176f4ee084455e860311af3..f4b7b4df5e1317b1fc0f4399789d5e321d43491d 100644
--- a/runtime/bin/websocket_impl.dart
+++ b/runtime/bin/websocket_impl.dart
@@ -586,8 +586,9 @@ class _WebSocketHandler implements WebSocketHandler {
response.headers.add(HttpHeaders.CONNECTION, "Upgrade");
response.headers.add(HttpHeaders.UPGRADE, "websocket");
String key = request.headers.value("Sec-WebSocket-Key");
- String accept =
- _Base64._encode(_Sha1._hash("$key$_webSocketGUID".charCodes()));
+ SHA1 sha1 = new SHA1();
+ sha1.update("$key$_webSocketGUID".charCodes());
+ String accept = _Base64._encode(sha1.digest());
response.headers.add("Sec-WebSocket-Accept", accept);
response.contentLength = 0;
@@ -729,8 +730,9 @@ class _WebSocketClientConnection
if (accept == null) {
return false;
}
- List<int> expectedAccept =
- _Sha1._hash("$_nonce$_webSocketGUID".charCodes());
+ SHA1 sha1 = new SHA1();
+ sha1.update("$_nonce$_webSocketGUID".charCodes());
+ List<int> expectedAccept = sha1.digest();
List<int> receivedAccept = _Base64._decode(accept);
if (expectedAccept.length != receivedAccept.length) return false;
for (int i = 0; i < expectedAccept.length; i++) {
« no previous file with comments | « runtime/bin/sha1.dart ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698