rocket-js 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -52
- data/spec/ruby/spec_helper.rb +2 -1
- metadata +7 -129
- data/src/vendor/web-socket-js/FABridge.js +0 -604
- data/src/vendor/web-socket-js/README.txt +0 -109
- data/src/vendor/web-socket-js/WebSocketMain.swf +0 -0
- data/src/vendor/web-socket-js/WebSocketMainInsecure.zip +0 -0
- data/src/vendor/web-socket-js/flash-src/WebSocket.as +0 -473
- data/src/vendor/web-socket-js/flash-src/WebSocketMain.as +0 -88
- data/src/vendor/web-socket-js/flash-src/WebSocketMainInsecure.as +0 -19
- data/src/vendor/web-socket-js/flash-src/WebSocketStateEvent.as +0 -32
- data/src/vendor/web-socket-js/flash-src/bridge/FABridge.as +0 -943
- data/src/vendor/web-socket-js/flash-src/build.sh +0 -10
- data/src/vendor/web-socket-js/flash-src/com/adobe/net/proxies/RFC2817Socket.as +0 -204
- data/src/vendor/web-socket-js/flash-src/com/gsolo/encryption/MD5.as +0 -375
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/Crypto.as +0 -287
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/MozillaRootCertificates.as +0 -3235
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509Certificate.as +0 -218
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/cert/X509CertificateCollection.as +0 -57
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/HMAC.as +0 -82
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHMAC.as +0 -27
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/IHash.as +0 -21
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MAC.as +0 -137
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD2.as +0 -124
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/MD5.as +0 -204
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA1.as +0 -106
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA224.as +0 -28
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHA256.as +0 -115
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/hash/SHABase.as +0 -71
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/ARC4.as +0 -90
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/IPRNG.as +0 -20
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/Random.as +0 -119
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/prng/TLSPRF.as +0 -142
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/rsa/RSAKey.as +0 -339
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/AESKey.as +0 -2797
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/BlowFishKey.as +0 -375
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CBCMode.as +0 -55
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFB8Mode.as +0 -61
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CFBMode.as +0 -64
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/CTRMode.as +0 -58
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/DESKey.as +0 -365
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ECBMode.as +0 -86
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ICipher.as +0 -21
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IMode.as +0 -15
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IPad.as +0 -32
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IStreamCipher.as +0 -21
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/ISymmetricKey.as +0 -35
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/IVMode.as +0 -110
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/NullPad.as +0 -34
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/OFBMode.as +0 -52
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/PKCS5.as +0 -44
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SSLPad.as +0 -44
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/SimpleIVMode.as +0 -60
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TLSPad.as +0 -42
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/TripleDESKey.as +0 -88
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/XTeaKey.as +0 -94
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/aeskey.pl +0 -29
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/symmetric/dump.txt +0 -2304
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/AESKeyTest.as +0 -1220
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ARC4Test.as +0 -58
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BigIntegerTest.as +0 -39
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/BlowFishKeyTest.as +0 -148
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CBCModeTest.as +0 -160
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFB8ModeTest.as +0 -71
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CFBModeTest.as +0 -98
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/CTRModeTest.as +0 -109
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/DESKeyTest.as +0 -112
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ECBModeTest.as +0 -151
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/HMACTest.as +0 -184
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/ITestHarness.as +0 -20
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD2Test.as +0 -56
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/MD5Test.as +0 -58
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/OFBModeTest.as +0 -101
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/RSAKeyTest.as +0 -92
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA1Test.as +0 -198
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA224Test.as +0 -58
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/SHA256Test.as +0 -60
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TLSPRFTest.as +0 -51
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TestCase.as +0 -42
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/TripleDESKeyTest.as +0 -59
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tests/XTeaKeyTest.as +0 -66
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/BulkCiphers.as +0 -102
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/CipherSuites.as +0 -117
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/IConnectionState.as +0 -14
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/ISecurityParameters.as +0 -29
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/KeyExchanges.as +0 -24
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as +0 -38
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLConnectionState.as +0 -171
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLEvent.as +0 -26
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/SSLSecurityParameters.as +0 -340
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConfig.as +0 -70
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSConnectionState.as +0 -151
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEngine.as +0 -895
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSError.as +0 -39
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSEvent.as +0 -27
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSecurityParameters.as +0 -197
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocket.as +0 -370
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSSocketEvent.as +0 -26
- data/src/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/TLSTest.as +0 -180
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/BarrettReduction.as +0 -90
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/BigInteger.as +0 -1543
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/ClassicReduction.as +0 -35
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/IReduction.as +0 -11
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/MontgomeryReduction.as +0 -85
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/NullReduction.as +0 -34
- data/src/vendor/web-socket-js/flash-src/com/hurlant/math/bi_internal.as +0 -11
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/ArrayUtil.as +0 -25
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/Base64.as +0 -189
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/Hex.as +0 -66
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/Memory.as +0 -28
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/ByteString.as +0 -43
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/DER.as +0 -210
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/IAsn1Type.as +0 -21
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/Integer.as +0 -44
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/OID.as +0 -35
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/ObjectIdentifier.as +0 -112
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/PEM.as +0 -118
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/PrintableString.as +0 -49
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/Sequence.as +0 -90
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/Set.as +0 -27
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/Type.as +0 -94
- data/src/vendor/web-socket-js/flash-src/com/hurlant/util/der/UTCTime.as +0 -60
- data/src/vendor/web-socket-js/sample.html +0 -76
- data/src/vendor/web-socket-js/swfobject.js +0 -4
- data/src/vendor/web-socket-js/web_socket.js +0 -388
@@ -1,124 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* MD2
|
3
|
-
*
|
4
|
-
* An ActionScript 3 implementation of the RSA Data Security, Inc MD2 Message
|
5
|
-
* Digest Algorithm, as defined in RFC 1319
|
6
|
-
* Copyright (c) 2007 Henri Torgemane
|
7
|
-
*
|
8
|
-
* See LICENSE.txt for full license information.
|
9
|
-
*
|
10
|
-
* Excerpt from http://en.wikipedia.org/wiki/MD2:
|
11
|
-
* >
|
12
|
-
* > Rogier and Chauvaud (1997) described collisions of MD2's compression function,
|
13
|
-
* > although they were unable to extend the attack to the full MD2.
|
14
|
-
* >
|
15
|
-
* > In 2004, MD2 was shown to be vulnerable to a preimage attack with time
|
16
|
-
* > complexity equivalent to 2104 applications of the compression function
|
17
|
-
* > (Muller, 2004).
|
18
|
-
* > The author concludes, "MD2 can no longer be considered a secure one-way
|
19
|
-
* > hash function".
|
20
|
-
*
|
21
|
-
* also, this implementaton is quite slow.
|
22
|
-
*/
|
23
|
-
|
24
|
-
package com.hurlant.crypto.hash
|
25
|
-
{
|
26
|
-
import flash.utils.ByteArray;
|
27
|
-
|
28
|
-
public class MD2 implements IHash
|
29
|
-
{
|
30
|
-
public static const HASH_SIZE:int = 16;
|
31
|
-
public var pad_size:int = 48; // probably will never get used, only here for SSL 3.0 support
|
32
|
-
|
33
|
-
private static const S:Array = [ // PI Digits
|
34
|
-
41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19,
|
35
|
-
98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202,
|
36
|
-
30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, 138, 23, 229, 18,
|
37
|
-
190, 78, 196, 214, 218, 158, 222, 73, 160, 251, 245, 142, 187, 47, 238, 122,
|
38
|
-
169, 104, 121, 145, 21, 178, 7, 63, 148, 194, 16, 137, 11, 34, 95, 33,
|
39
|
-
128, 127, 93, 154, 90, 144, 50, 39, 53, 62, 204, 231, 191, 247, 151, 3,
|
40
|
-
255, 25, 48, 179, 72, 165, 181, 209, 215, 94, 146, 42, 172, 86, 170, 198,
|
41
|
-
79, 184, 56, 210, 150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241,
|
42
|
-
69, 157, 112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2,
|
43
|
-
27, 96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15,
|
44
|
-
85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197, 234, 38,
|
45
|
-
44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65, 129, 77, 82,
|
46
|
-
106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123, 8, 12, 189, 177, 74,
|
47
|
-
120, 136, 149, 139, 227, 99, 232, 109, 233, 203, 213, 254, 59, 0, 29, 57,
|
48
|
-
242, 239, 183, 14, 102, 88, 208, 228, 166, 119, 114, 248, 235, 117, 75, 10,
|
49
|
-
49, 68, 80, 180, 143, 237, 31, 26, 219, 153, 141, 51, 159, 17, 131, 20 ];
|
50
|
-
|
51
|
-
|
52
|
-
public function MD2() { }
|
53
|
-
|
54
|
-
public function getInputSize():uint
|
55
|
-
{
|
56
|
-
return 16;
|
57
|
-
}
|
58
|
-
|
59
|
-
public function getPadSize():int {
|
60
|
-
return pad_size;
|
61
|
-
}
|
62
|
-
|
63
|
-
public function getHashSize():uint
|
64
|
-
{
|
65
|
-
return HASH_SIZE;
|
66
|
-
}
|
67
|
-
|
68
|
-
public function hash(src:ByteArray):ByteArray
|
69
|
-
{
|
70
|
-
var savedLength:uint = src.length;
|
71
|
-
|
72
|
-
// 3.1 Step 1. Padding
|
73
|
-
var i:uint = (16-src.length%16) || 16;
|
74
|
-
do {
|
75
|
-
src[src.length]=i;
|
76
|
-
} while (src.length%16!=0);
|
77
|
-
|
78
|
-
// 3.2 Step 2. Checksum
|
79
|
-
var len:uint = src.length;
|
80
|
-
var checksum:ByteArray = new ByteArray;
|
81
|
-
var L:uint = 0;
|
82
|
-
for (i = 0;i<len;i+=16) {
|
83
|
-
for (var j:uint=0;j<16;j++) {
|
84
|
-
L = checksum[j] ^= S[src[i+j] ^ L];
|
85
|
-
}
|
86
|
-
}
|
87
|
-
src.position = src.length;
|
88
|
-
src.writeBytes(checksum);
|
89
|
-
len += 16;
|
90
|
-
|
91
|
-
// 3.3 Step 3. MD Buffer
|
92
|
-
var X:ByteArray = new ByteArray;
|
93
|
-
|
94
|
-
// 3.4 Process Message
|
95
|
-
for (i=0;i<len;i+=16) {
|
96
|
-
|
97
|
-
/* Copy block i into X */
|
98
|
-
for (j=0;j<16;j++) {
|
99
|
-
X[32+j] = (X[16+j] = src[i+j])^X[j];
|
100
|
-
}
|
101
|
-
var t:uint=0;
|
102
|
-
/* Do 18 rounds */
|
103
|
-
for (j=0;j<18;j++) {
|
104
|
-
/* Round j. */
|
105
|
-
for (var k:uint=0;k<48;k++) {
|
106
|
-
X[k] = t = X[k]^S[t];
|
107
|
-
}
|
108
|
-
t = (t+j)&0xff;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
// 3.5 Step 5. Output
|
112
|
-
X.length = 16;
|
113
|
-
// restore original length;
|
114
|
-
src.length = savedLength;
|
115
|
-
return X;
|
116
|
-
}
|
117
|
-
|
118
|
-
public function toString():String
|
119
|
-
{
|
120
|
-
return "md2";
|
121
|
-
}
|
122
|
-
|
123
|
-
}
|
124
|
-
}
|
@@ -1,204 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* MD5
|
3
|
-
*
|
4
|
-
* An ActionScript 3 implementation of the RSA Data Security, Inc. MD5 Message
|
5
|
-
* Digest Algorithm, as defined in RFC 1321.
|
6
|
-
* Copyright (c) 2007 Henri Torgemane
|
7
|
-
*
|
8
|
-
* Derived from
|
9
|
-
* A JavaScript implementation of the same.
|
10
|
-
* Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
|
11
|
-
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
12
|
-
*
|
13
|
-
* Note:
|
14
|
-
* This algorithm should not be your first choice for new developements, but is
|
15
|
-
* included to allow interoperability with existing codes and protocols.
|
16
|
-
*
|
17
|
-
* See LICENSE.txt for full license information.
|
18
|
-
*/
|
19
|
-
package com.hurlant.crypto.hash
|
20
|
-
{
|
21
|
-
import flash.utils.ByteArray;
|
22
|
-
import flash.utils.Endian;
|
23
|
-
|
24
|
-
public class MD5 implements IHash
|
25
|
-
{
|
26
|
-
public static const HASH_SIZE:int = 16;
|
27
|
-
public var pad_size:int = 48;
|
28
|
-
|
29
|
-
public function MD5() { }
|
30
|
-
|
31
|
-
public function getInputSize():uint
|
32
|
-
{
|
33
|
-
return 64;
|
34
|
-
}
|
35
|
-
|
36
|
-
public function getHashSize():uint
|
37
|
-
{
|
38
|
-
return HASH_SIZE;
|
39
|
-
}
|
40
|
-
|
41
|
-
public function getPadSize():int
|
42
|
-
{
|
43
|
-
return pad_size;
|
44
|
-
}
|
45
|
-
|
46
|
-
public function hash(src:ByteArray):ByteArray
|
47
|
-
{
|
48
|
-
var len:uint = src.length *8;
|
49
|
-
var savedEndian:String = src.endian;
|
50
|
-
// pad to nearest int.
|
51
|
-
while (src.length%4!=0) {
|
52
|
-
src[src.length]=0;
|
53
|
-
}
|
54
|
-
// convert ByteArray to an array of uint
|
55
|
-
src.position=0;
|
56
|
-
var a:Array = [];
|
57
|
-
src.endian=Endian.LITTLE_ENDIAN
|
58
|
-
for (var i:uint=0;i<src.length;i+=4) {
|
59
|
-
a.push(src.readUnsignedInt());
|
60
|
-
}
|
61
|
-
var h:Array = core_md5(a, len);
|
62
|
-
var out:ByteArray = new ByteArray;
|
63
|
-
out.endian=Endian.LITTLE_ENDIAN;
|
64
|
-
for (i=0;i<4;i++) {
|
65
|
-
out.writeUnsignedInt(h[i]);
|
66
|
-
}
|
67
|
-
// restore length!
|
68
|
-
src.length = len/8;
|
69
|
-
src.endian = savedEndian;
|
70
|
-
|
71
|
-
return out;
|
72
|
-
}
|
73
|
-
|
74
|
-
private function core_md5(x:Array, len:uint):Array {
|
75
|
-
/* append padding */
|
76
|
-
x[len >> 5] |= 0x80 << ((len) % 32);
|
77
|
-
x[(((len + 64) >>> 9) << 4) + 14] = len;
|
78
|
-
|
79
|
-
var a:uint = 0x67452301; // 1732584193;
|
80
|
-
var b:uint = 0xEFCDAB89; //-271733879;
|
81
|
-
var c:uint = 0x98BADCFE; //-1732584194;
|
82
|
-
var d:uint = 0x10325476; // 271733878;
|
83
|
-
|
84
|
-
for(var i:uint = 0; i < x.length; i += 16)
|
85
|
-
{
|
86
|
-
x[i]||=0; x[i+1]||=0; x[i+2]||=0; x[i+3]||=0;
|
87
|
-
x[i+4]||=0; x[i+5]||=0; x[i+6]||=0; x[i+7]||=0;
|
88
|
-
x[i+8]||=0; x[i+9]||=0; x[i+10]||=0; x[i+11]||=0;
|
89
|
-
x[i+12]||=0; x[i+13]||=0; x[i+14]||=0; x[i+15]||=0;
|
90
|
-
|
91
|
-
var olda:uint = a;
|
92
|
-
var oldb:uint = b;
|
93
|
-
var oldc:uint = c;
|
94
|
-
var oldd:uint = d;
|
95
|
-
|
96
|
-
a = ff(a, b, c, d, x[i+ 0], 7 , 0xD76AA478);
|
97
|
-
d = ff(d, a, b, c, x[i+ 1], 12, 0xE8C7B756);
|
98
|
-
c = ff(c, d, a, b, x[i+ 2], 17, 0x242070DB);
|
99
|
-
b = ff(b, c, d, a, x[i+ 3], 22, 0xC1BDCEEE);
|
100
|
-
a = ff(a, b, c, d, x[i+ 4], 7 , 0xF57C0FAF);
|
101
|
-
d = ff(d, a, b, c, x[i+ 5], 12, 0x4787C62A);
|
102
|
-
c = ff(c, d, a, b, x[i+ 6], 17, 0xA8304613);
|
103
|
-
b = ff(b, c, d, a, x[i+ 7], 22, 0xFD469501);
|
104
|
-
a = ff(a, b, c, d, x[i+ 8], 7 , 0x698098D8);
|
105
|
-
d = ff(d, a, b, c, x[i+ 9], 12, 0x8B44F7AF);
|
106
|
-
c = ff(c, d, a, b, x[i+10], 17, 0xFFFF5BB1);
|
107
|
-
b = ff(b, c, d, a, x[i+11], 22, 0x895CD7BE);
|
108
|
-
a = ff(a, b, c, d, x[i+12], 7 , 0x6B901122);
|
109
|
-
d = ff(d, a, b, c, x[i+13], 12, 0xFD987193);
|
110
|
-
c = ff(c, d, a, b, x[i+14], 17, 0xA679438E);
|
111
|
-
b = ff(b, c, d, a, x[i+15], 22, 0x49B40821);
|
112
|
-
|
113
|
-
a = gg(a, b, c, d, x[i+ 1], 5 , 0xf61e2562);
|
114
|
-
d = gg(d, a, b, c, x[i+ 6], 9 , 0xc040b340);
|
115
|
-
c = gg(c, d, a, b, x[i+11], 14, 0x265e5a51);
|
116
|
-
b = gg(b, c, d, a, x[i+ 0], 20, 0xe9b6c7aa);
|
117
|
-
a = gg(a, b, c, d, x[i+ 5], 5 , 0xd62f105d);
|
118
|
-
d = gg(d, a, b, c, x[i+10], 9 , 0x2441453);
|
119
|
-
c = gg(c, d, a, b, x[i+15], 14, 0xd8a1e681);
|
120
|
-
b = gg(b, c, d, a, x[i+ 4], 20, 0xe7d3fbc8);
|
121
|
-
a = gg(a, b, c, d, x[i+ 9], 5 , 0x21e1cde6);
|
122
|
-
d = gg(d, a, b, c, x[i+14], 9 , 0xc33707d6);
|
123
|
-
c = gg(c, d, a, b, x[i+ 3], 14, 0xf4d50d87);
|
124
|
-
b = gg(b, c, d, a, x[i+ 8], 20, 0x455a14ed);
|
125
|
-
a = gg(a, b, c, d, x[i+13], 5 , 0xa9e3e905);
|
126
|
-
d = gg(d, a, b, c, x[i+ 2], 9 , 0xfcefa3f8);
|
127
|
-
c = gg(c, d, a, b, x[i+ 7], 14, 0x676f02d9);
|
128
|
-
b = gg(b, c, d, a, x[i+12], 20, 0x8d2a4c8a);
|
129
|
-
|
130
|
-
a = hh(a, b, c, d, x[i+ 5], 4 , 0xfffa3942);
|
131
|
-
d = hh(d, a, b, c, x[i+ 8], 11, 0x8771f681);
|
132
|
-
c = hh(c, d, a, b, x[i+11], 16, 0x6d9d6122);
|
133
|
-
b = hh(b, c, d, a, x[i+14], 23, 0xfde5380c);
|
134
|
-
a = hh(a, b, c, d, x[i+ 1], 4 , 0xa4beea44);
|
135
|
-
d = hh(d, a, b, c, x[i+ 4], 11, 0x4bdecfa9);
|
136
|
-
c = hh(c, d, a, b, x[i+ 7], 16, 0xf6bb4b60);
|
137
|
-
b = hh(b, c, d, a, x[i+10], 23, 0xbebfbc70);
|
138
|
-
a = hh(a, b, c, d, x[i+13], 4 , 0x289b7ec6);
|
139
|
-
d = hh(d, a, b, c, x[i+ 0], 11, 0xeaa127fa);
|
140
|
-
c = hh(c, d, a, b, x[i+ 3], 16, 0xd4ef3085);
|
141
|
-
b = hh(b, c, d, a, x[i+ 6], 23, 0x4881d05);
|
142
|
-
a = hh(a, b, c, d, x[i+ 9], 4 , 0xd9d4d039);
|
143
|
-
d = hh(d, a, b, c, x[i+12], 11, 0xe6db99e5);
|
144
|
-
c = hh(c, d, a, b, x[i+15], 16, 0x1fa27cf8);
|
145
|
-
b = hh(b, c, d, a, x[i+ 2], 23, 0xc4ac5665);
|
146
|
-
|
147
|
-
a = ii(a, b, c, d, x[i+ 0], 6 , 0xf4292244);
|
148
|
-
d = ii(d, a, b, c, x[i+ 7], 10, 0x432aff97);
|
149
|
-
c = ii(c, d, a, b, x[i+14], 15, 0xab9423a7);
|
150
|
-
b = ii(b, c, d, a, x[i+ 5], 21, 0xfc93a039);
|
151
|
-
a = ii(a, b, c, d, x[i+12], 6 , 0x655b59c3);
|
152
|
-
d = ii(d, a, b, c, x[i+ 3], 10, 0x8f0ccc92);
|
153
|
-
c = ii(c, d, a, b, x[i+10], 15, 0xffeff47d);
|
154
|
-
b = ii(b, c, d, a, x[i+ 1], 21, 0x85845dd1);
|
155
|
-
a = ii(a, b, c, d, x[i+ 8], 6 , 0x6fa87e4f);
|
156
|
-
d = ii(d, a, b, c, x[i+15], 10, 0xfe2ce6e0);
|
157
|
-
c = ii(c, d, a, b, x[i+ 6], 15, 0xa3014314);
|
158
|
-
b = ii(b, c, d, a, x[i+13], 21, 0x4e0811a1);
|
159
|
-
a = ii(a, b, c, d, x[i+ 4], 6 , 0xf7537e82);
|
160
|
-
d = ii(d, a, b, c, x[i+11], 10, 0xbd3af235);
|
161
|
-
c = ii(c, d, a, b, x[i+ 2], 15, 0x2ad7d2bb);
|
162
|
-
b = ii(b, c, d, a, x[i+ 9], 21, 0xeb86d391);
|
163
|
-
|
164
|
-
a += olda;
|
165
|
-
b += oldb;
|
166
|
-
c += oldc;
|
167
|
-
d += oldd;
|
168
|
-
|
169
|
-
}
|
170
|
-
return [ a, b, c, d ];
|
171
|
-
}
|
172
|
-
|
173
|
-
/*
|
174
|
-
* Bitwise rotate a 32-bit number to the left.
|
175
|
-
*/
|
176
|
-
private function rol(num:uint, cnt:uint):uint
|
177
|
-
{
|
178
|
-
return (num << cnt) | (num >>> (32 - cnt));
|
179
|
-
}
|
180
|
-
|
181
|
-
/*
|
182
|
-
* These functions implement the four basic operations the algorithm uses.
|
183
|
-
*/
|
184
|
-
private function cmn(q:uint, a:uint, b:uint, x:uint, s:uint, t:uint):uint {
|
185
|
-
return rol(a + q + x + t, s) + b;
|
186
|
-
}
|
187
|
-
private function ff(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint {
|
188
|
-
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
189
|
-
}
|
190
|
-
private function gg(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint {
|
191
|
-
return cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
192
|
-
}
|
193
|
-
private function hh(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint {
|
194
|
-
return cmn(b ^ c ^ d, a, b, x, s, t);
|
195
|
-
}
|
196
|
-
private function ii(a:uint, b:uint, c:uint, d:uint, x:uint, s:uint, t:uint):uint {
|
197
|
-
return cmn(c ^ (b | (~d)), a, b, x, s, t);
|
198
|
-
}
|
199
|
-
|
200
|
-
public function toString():String {
|
201
|
-
return "md5";
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
@@ -1,106 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* SHA1
|
3
|
-
*
|
4
|
-
* An ActionScript 3 implementation of Secure Hash Algorithm, SHA-1, as defined
|
5
|
-
* in FIPS PUB 180-1
|
6
|
-
* Copyright (c) 2007 Henri Torgemane
|
7
|
-
*
|
8
|
-
* Derived from:
|
9
|
-
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
|
10
|
-
* in FIPS PUB 180-1
|
11
|
-
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
|
12
|
-
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
13
|
-
*
|
14
|
-
* See LICENSE.txt for full license information.
|
15
|
-
*/
|
16
|
-
package com.hurlant.crypto.hash
|
17
|
-
{
|
18
|
-
|
19
|
-
|
20
|
-
public class SHA1 extends SHABase implements IHash
|
21
|
-
{
|
22
|
-
public static const HASH_SIZE:int = 20;
|
23
|
-
|
24
|
-
public override function getHashSize():uint {
|
25
|
-
return HASH_SIZE;
|
26
|
-
}
|
27
|
-
|
28
|
-
protected override function core(x:Array, len:uint):Array
|
29
|
-
{
|
30
|
-
/* append padding */
|
31
|
-
x[len >> 5] |= 0x80 << (24 - len % 32);
|
32
|
-
x[((len + 64 >> 9) << 4) + 15] = len;
|
33
|
-
|
34
|
-
var w:Array = [];
|
35
|
-
var a:uint = 0x67452301; //1732584193;
|
36
|
-
var b:uint = 0xEFCDAB89; //-271733879;
|
37
|
-
var c:uint = 0x98BADCFE; //-1732584194;
|
38
|
-
var d:uint = 0x10325476; //271733878;
|
39
|
-
var e:uint = 0xC3D2E1F0; //-1009589776;
|
40
|
-
|
41
|
-
for(var i:uint = 0; i < x.length; i += 16)
|
42
|
-
{
|
43
|
-
|
44
|
-
var olda:uint = a;
|
45
|
-
var oldb:uint = b;
|
46
|
-
var oldc:uint = c;
|
47
|
-
var oldd:uint = d;
|
48
|
-
var olde:uint = e;
|
49
|
-
|
50
|
-
for(var j:uint = 0; j < 80; j++)
|
51
|
-
{
|
52
|
-
if (j < 16) {
|
53
|
-
w[j] = x[i + j] || 0;
|
54
|
-
} else {
|
55
|
-
w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
|
56
|
-
}
|
57
|
-
var t:uint = rol(a,5) + ft(j,b,c,d) + e + w[j] + kt(j);
|
58
|
-
e = d;
|
59
|
-
d = c;
|
60
|
-
c = rol(b, 30);
|
61
|
-
b = a;
|
62
|
-
a = t;
|
63
|
-
}
|
64
|
-
a += olda;
|
65
|
-
b += oldb;
|
66
|
-
c += oldc;
|
67
|
-
d += oldd;
|
68
|
-
e += olde;
|
69
|
-
}
|
70
|
-
return [ a, b, c, d, e ];
|
71
|
-
|
72
|
-
}
|
73
|
-
|
74
|
-
/*
|
75
|
-
* Bitwise rotate a 32-bit number to the left.
|
76
|
-
*/
|
77
|
-
private function rol(num:uint, cnt:uint):uint
|
78
|
-
{
|
79
|
-
return (num << cnt) | (num >>> (32 - cnt));
|
80
|
-
}
|
81
|
-
|
82
|
-
/*
|
83
|
-
* Perform the appropriate triplet combination function for the current
|
84
|
-
* iteration
|
85
|
-
*/
|
86
|
-
private function ft(t:uint, b:uint, c:uint, d:uint):uint
|
87
|
-
{
|
88
|
-
if(t < 20) return (b & c) | ((~b) & d);
|
89
|
-
if(t < 40) return b ^ c ^ d;
|
90
|
-
if(t < 60) return (b & c) | (b & d) | (c & d);
|
91
|
-
return b ^ c ^ d;
|
92
|
-
}
|
93
|
-
|
94
|
-
/*
|
95
|
-
* Determine the appropriate additive constant for the current iteration
|
96
|
-
*/
|
97
|
-
private function kt(t:uint):uint
|
98
|
-
{
|
99
|
-
return (t < 20) ? 0x5A827999 : (t < 40) ? 0x6ED9EBA1 :
|
100
|
-
(t < 60) ? 0x8F1BBCDC : 0xCA62C1D6;
|
101
|
-
}
|
102
|
-
public override function toString():String {
|
103
|
-
return "sha1";
|
104
|
-
}
|
105
|
-
}
|
106
|
-
}
|
@@ -1,28 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* SHA224
|
3
|
-
*
|
4
|
-
* An ActionScript 3 implementation of Secure Hash Algorithm, SHA-224, as defined
|
5
|
-
* in FIPS PUB 180-2
|
6
|
-
* Copyright (c) 2007 Henri Torgemane
|
7
|
-
*
|
8
|
-
* See LICENSE.txt for full license information.
|
9
|
-
*/
|
10
|
-
package com.hurlant.crypto.hash
|
11
|
-
{
|
12
|
-
public class SHA224 extends SHA256
|
13
|
-
{
|
14
|
-
function SHA224() {
|
15
|
-
h = [
|
16
|
-
0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
|
17
|
-
0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
|
18
|
-
];
|
19
|
-
}
|
20
|
-
|
21
|
-
public override function getHashSize():uint {
|
22
|
-
return 28;
|
23
|
-
}
|
24
|
-
public override function toString():String {
|
25
|
-
return "sha224";
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|