4 * An enumeration of MACs implemented for TLS 1.0/SSL 3.0
\r
5 * Copyright (c) 2007 Henri Torgemane
\r
7 * See LICENSE.txt for full license information.
\r
9 package com.hurlant.crypto.tls {
\r
10 import com.hurlant.crypto.Crypto;
\r
11 import com.hurlant.crypto.hash.HMAC;
\r
12 import com.hurlant.crypto.hash.MAC;
\r
15 public static const NULL:uint = 0;
\r
16 public static const MD5:uint = 1;
\r
17 public static const SHA1:uint = 2;
\r
19 public static function getHashSize(hash:uint):uint {
\r
20 return [0,16,20][hash];
\r
23 public static function getPadSize(hash:uint):int {
\r
24 return [0, 48, 40][hash];
\r
27 public static function getHMAC(hash:uint):HMAC {
\r
28 if (hash==NULL) return null;
\r
29 return Crypto.getHMAC(['',"md5","sha1"][hash]);
\r
32 public static function getMAC(hash:uint):MAC {
\r
33 return Crypto.getMAC(['', "md5", "sha1"][hash]);
\r