macs.as

来自「As3 Crypto is a cryptography library wri」· AS 代码 · 共 27 行

AS
27
字号
/**
 * MACs
 * 
 * An enumeration of MACs implemented for TLS
 * Copyright (c) 2007 Henri Torgemane
 * 
 * See LICENSE.txt for full license information.
 */
package com.hurlant.crypto.tls {
	import com.hurlant.crypto.hash.HMAC;
	import com.hurlant.crypto.Crypto;
	
	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 getHMAC(hash:uint):HMAC {
			if (hash==NULL) return null;
			return Crypto.getHMAC(['',"md5","sha1"][hash]);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?