PageRenderTime 21ms CodeModel.GetById 15ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/socket.io-client/lib/vendor/web-socket-js/flash-src/com/hurlant/crypto/tls/MACs.as

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
ActionScript | 38 lines | 23 code | 7 blank | 8 comment | 1 complexity | 291fdae9bb869c839141f655038156e4 MD5 | raw file
 1/**
 2 * MACs
 3 * 
 4 * An enumeration of MACs implemented for TLS 1.0/SSL 3.0
 5 * Copyright (c) 2007 Henri Torgemane
 6 * 
 7 * See LICENSE.txt for full license information.
 8 */
 9package com.hurlant.crypto.tls {
10	import com.hurlant.crypto.Crypto;
11	import com.hurlant.crypto.hash.HMAC;
12	import com.hurlant.crypto.hash.MAC;
13	
14	public class MACs {
15		public static const NULL:uint = 0;
16		public static const MD5:uint = 1;
17		public static const SHA1:uint = 2;
18		
19		public static function getHashSize(hash:uint):uint {
20			return [0,16,20][hash];
21		}	
22		
23		public static function getPadSize(hash:uint):int {
24			return [0, 48, 40][hash];
25		}	
26		
27		public static function getHMAC(hash:uint):HMAC {
28			if (hash==NULL) return null;
29			return Crypto.getHMAC(['',"md5","sha1"][hash]);
30		}
31	
32		public static function getMAC(hash:uint):MAC {
33			return Crypto.getMAC(['', "md5", "sha1"][hash]);
34		} 
35		
36		
37	}
38}