aboutsummaryrefslogtreecommitdiffstats
path: root/signaling-server/node_modules/socket.io/node_modules/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as
blob: 09d79e7d51efdf25469f4159e9bb082d79a8dbd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
 * MACs
 * 
 * An enumeration of MACs implemented for TLS 1.0/SSL 3.0
 * Copyright (c) 2007 Henri Torgemane
 * 
 * See LICENSE.txt for full license information.
 */
package com.hurlant.crypto.tls {
	import com.hurlant.crypto.Crypto;
	import com.hurlant.crypto.hash.HMAC;
	import com.hurlant.crypto.hash.MAC;
	
	public class MACs {
		public static const NULL:uint = 0;
		public static const MD5:uint = 1;
		public static const SHA1:uint = 2;
		
		public static function getHashSize(hash:uint):uint {
			return [0,16,20][hash];
		}	
		
		public static function getPadSize(hash:uint):int {
			return [0, 48, 40][hash];
		}	
		
		public static function getHMAC(hash:uint):HMAC {
			if (hash==NULL) return null;
			return Crypto.getHMAC(['',"md5","sha1"][hash]);
		}
	
		public static function getMAC(hash:uint):MAC {
			return Crypto.getMAC(['', "md5", "sha1"][hash]);
		} 
		
		
	}
}