/// <summary>Initializes a new instance of the HAVAL class.</summary> /// <param name="parameters">The parameters to utilize in the HAVAL calculation.</param> /// <exception cref="ArgumentNullException">When the specified parameters are null.</exception> public Haval(HavalParameters parameters) : base(128) { lock (syncLock) { if (parameters == null) { throw new ArgumentNullException("parameters", Hasher.Properties.Resources.paramCantBeNull); } this.parameters = parameters; HashSizeValue = this.parameters.Length; } }
/// <summary>Retrieves a standard set of HAVAL parameters.</summary> /// <param name="standard">The name of the standard parameter set to retrieve.</param> /// <returns>The HAVAL Parameters for the given standard.</returns> public static HavalParameters GetParameters(HavalStandard standard) { HavalParameters temp = null; switch (standard) { case HavalStandard.Haval128Bit3Pass: temp = new HavalParameters(3, 128); break; case HavalStandard.Haval160Bit3Pass: temp = new HavalParameters(3, 160); break; case HavalStandard.Haval192Bit3Pass: temp = new HavalParameters(3, 192); break; case HavalStandard.Haval224Bit3Pass: temp = new HavalParameters(3, 224); break; case HavalStandard.Haval256Bit3Pass: temp = new HavalParameters(3, 256); break; case HavalStandard.Haval128Bit4Pass: temp = new HavalParameters(4, 128); break; case HavalStandard.Haval160Bit4Pass: temp = new HavalParameters(4, 160); break; case HavalStandard.Haval192Bit4Pass: temp = new HavalParameters(4, 192); break; case HavalStandard.Haval224Bit4Pass: temp = new HavalParameters(4, 224); break; case HavalStandard.Haval256Bit4Pass: temp = new HavalParameters(4, 256); break; case HavalStandard.Haval128Bit5Pass: temp = new HavalParameters(5, 128); break; case HavalStandard.Haval160Bit5Pass: temp = new HavalParameters(5, 160); break; case HavalStandard.Haval192Bit5Pass: temp = new HavalParameters(5, 192); break; case HavalStandard.Haval224Bit5Pass: temp = new HavalParameters(5, 224); break; case HavalStandard.Haval256Bit5Pass: temp = new HavalParameters(5, 256); break; } return(temp); }
/// <summary>Initializes a new instance of the HAVAL class.</summary> /// <remarks>This constructor implements the default parameters of Haval256Bit5Pass.</remarks> public Haval() : this(HavalParameters.GetParameters(HavalStandard.Haval256Bit5Pass)) { }