From ba3d7af433aabb94c58a9f13416d81bb5b0c5762 Mon Sep 17 00:00:00 2001 From: Hiroshi Ichikawa Date: Mon, 19 Sep 2011 09:33:58 +0900 Subject: Fixing a bug that decoded key was not 16 bytes. --- WebSocketMain.swf | Bin 176011 -> 176009 bytes WebSocketMainInsecure.zip | Bin 166896 -> 166856 bytes flash-src/src/net/gimite/websocket/WebSocket.as | 9 +++++---- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WebSocketMain.swf b/WebSocketMain.swf index fbdb479..016c4d5 100644 Binary files a/WebSocketMain.swf and b/WebSocketMain.swf differ diff --git a/WebSocketMainInsecure.zip b/WebSocketMainInsecure.zip index 2793d76..0d5e693 100644 Binary files a/WebSocketMainInsecure.zip and b/WebSocketMainInsecure.zip differ diff --git a/flash-src/src/net/gimite/websocket/WebSocket.as b/flash-src/src/net/gimite/websocket/WebSocket.as index 20f11ba..fb3555e 100644 --- a/flash-src/src/net/gimite/websocket/WebSocket.as +++ b/flash-src/src/net/gimite/websocket/WebSocket.as @@ -474,12 +474,13 @@ public class WebSocket extends EventDispatcher { } private function generateKey():String { - var vals:String = ""; - for (var i:int = 0; i < 16; i++) { - vals = vals + randomInt(0, 127).toString(); + var vals:ByteArray = new ByteArray(); + vals.length = 16; + for (var i:int = 0; i < vals.length; ++i) { + vals[i] = randomInt(0, 127); } base64Encoder.reset(); - base64Encoder.encode(vals); + base64Encoder.encodeBytes(vals); return base64Encoder.toString(); } -- cgit v1.2.1