/// <summary>Initializes a new instance of the Fletcher class.</summary>
 /// <param name="parameters">The parameters to utilize in the Fletcher calculation.</param>
 /// <exception cref="ArgumentNullException">When the specified parameters are null.</exception>
 public Fletcher(FletcherParameters parameters) : base()
 {
     lock (syncLock) {
         if (parameters == null)
         {
             throw new ArgumentNullException("parameters", Properties.Resources.paramCantBeNull);
         }
         this.parameters = parameters;
         HashSizeValue   = this.parameters.Order;
         modulo          = (uint)(Math.Pow(2, (this.parameters.Order / 2)) - 1);
     }
 }
Example #2
0
        /// <summary>Retrieves a standard set of Fletcher parameters.</summary>
        /// <param name="standard">The name of the standard parameter set to retrieve.</param>
        /// <returns>The Fletcher Parameters for the given standard.</returns>
        public static FletcherParameters GetParameters(FletcherStandard standard)
        {
            FletcherParameters temp = null;

            switch (standard)
            {
            case FletcherStandard.Fletcher8Bit: temp = new FletcherParameters(8); break;

            case FletcherStandard.Fletcher16Bit: temp = new FletcherParameters(16); break;

            case FletcherStandard.Fletcher32Bit: temp = new FletcherParameters(32); break;
            }

            return(temp);
        }
 /// <summary>Initializes a new instance of the Fletcher class.</summary>
 /// <remarks>This constructor implements the default parameters of Fletcher32Bit.</remarks>
 public Fletcher() : this(FletcherParameters.GetParameters(FletcherStandard.Fletcher32Bit))
 {
 }