From b60df56157ee1fd0bd4938799bac05a62fda91a1 Mon Sep 17 00:00:00 2001 From: lookshe Date: Sat, 14 Mar 2015 20:45:20 +0100 Subject: initial commit from working version --- .../flash-src/com/hurlant/crypto/hash/HMAC.as | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as (limited to 'signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as') diff --git a/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as new file mode 100644 index 0000000..8215afc --- /dev/null +++ b/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as @@ -0,0 +1,82 @@ +/** + * HMAC + * + * An ActionScript 3 implementation of HMAC, Keyed-Hashing for Message + * Authentication, as defined by RFC-2104 + * Copyright (c) 2007 Henri Torgemane + * + * See LICENSE.txt for full license information. + */ +package com.hurlant.crypto.hash +{ + import flash.utils.ByteArray; + import com.hurlant.util.Hex; + + public class HMAC implements IHMAC + { + private var hash:IHash; + private var bits:uint; + + /** + * Create a HMAC object, using a Hash function, and + * optionally a number of bits to return. + * The HMAC will be truncated to that size if needed. + */ + public function HMAC(hash:IHash, bits:uint=0) { + this.hash = hash; + this.bits = bits; + } + + + public function getHashSize():uint { + if (bits!=0) { + return bits/8; + } else { + return hash.getHashSize(); + } + } + + /** + * Compute a HMAC using a key and some data. + * It doesn't modify either, and returns a new ByteArray with the HMAC value. + */ + public function compute(key:ByteArray, data:ByteArray):ByteArray { + var hashKey:ByteArray; + if (key.length>hash.getInputSize()) { + hashKey = hash.hash(key); + } else { + hashKey = new ByteArray; + hashKey.writeBytes(key); + } + while (hashKey.length0 && bits<8*outerHash.length) { + outerHash.length = bits/8; + } + return outerHash; + } + public function dispose():void { + hash = null; + bits = 0; + } + public function toString():String { + return "hmac-"+(bits>0?bits+"-":"")+hash.toString(); + } + + } +} \ No newline at end of file -- cgit v1.2.3