/////////////////////////////////////////// /// <summary> /// Snefru Hash Family /// </summary> //////////////////////////////////////////// /// <summary> /// /// </summary> /// <param name="a_security_level">any Integer value greater than 0. Standard is 8. </param> /// <param name="a_hash_size">128bit, 256bit</param> /// <returns></returns> public static IHash CreateSnefru(Int32 a_security_level, HashSizeEnum a_hash_size) { if (a_security_level < 1) { throw new ArgumentHashLibException(Snefru.InvalidSnefruLevel); } if ((a_hash_size == HashSizeEnum.HashSize128) || (a_hash_size == HashSizeEnum.HashSize256)) { return(new Snefru(a_security_level, (Int32)a_hash_size)); } else { throw new ArgumentHashLibException(Snefru.InvalidSnefruHashSize); } } // end function CreateSnefru
/////////////////////////////////////////// /// <summary> /// Haval Hash Family /// </summary> //////////////////////////////////////////// /// <summary> /// /// </summary> /// <param name="a_rounds">3, 4, 5</param> /// <param name="a_hash_size">128, 160, 192, 224, 256</param> /// <returns></returns> public static IHash CreateHaval(HashRounds a_rounds, HashSizeEnum a_hash_size) { switch (a_rounds) { case HashRounds.Rounds3: switch (a_hash_size) { case HashSizeEnum.HashSize128: return(CreateHaval_3_128()); case HashSizeEnum.HashSize160: return(CreateHaval_3_160()); case HashSizeEnum.HashSize192: return(CreateHaval_3_192()); case HashSizeEnum.HashSize224: return(CreateHaval_3_224()); case HashSizeEnum.HashSize256: return(CreateHaval_3_256()); default: throw new ArgumentHashLibException(Haval.InvalidHavalHashSize); } // end switch case HashRounds.Rounds4: switch (a_hash_size) { case HashSizeEnum.HashSize128: return(CreateHaval_4_128()); case HashSizeEnum.HashSize160: return(CreateHaval_4_160()); case HashSizeEnum.HashSize192: return(CreateHaval_4_192()); case HashSizeEnum.HashSize224: return(CreateHaval_4_224()); case HashSizeEnum.HashSize256: return(CreateHaval_4_256()); default: throw new ArgumentHashLibException(Haval.InvalidHavalHashSize); } // end switch case HashRounds.Rounds5: switch (a_hash_size) { case HashSizeEnum.HashSize128: return(CreateHaval_5_128()); case HashSizeEnum.HashSize160: return(CreateHaval_5_160()); case HashSizeEnum.HashSize192: return(CreateHaval_5_192()); case HashSizeEnum.HashSize224: return(CreateHaval_5_224()); case HashSizeEnum.HashSize256: return(CreateHaval_5_256()); default: throw new ArgumentHashLibException(Haval.InvalidHavalHashSize); } // end switch default: throw new ArgumentHashLibException(Haval.InvalidHavalRound); } // end switch } // end function Haval
} // end function Clone private Tiger2_192(HashSizeEnum a_hash_size, HashRounds a_rounds) : base((Int32)a_hash_size, a_rounds) { }