Esempio n. 1
0
        /// <summary>
        /// Creates a new <see cref="ICRC" /> instance with given configuration.
        /// </summary>
        /// <param name="config">The configuration to use.</param>
        /// <returns>
        /// A <see cref="ICRC" /> instance.
        /// </returns>
        public ICRC Create(ICRCConfig config)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            return(new CRC_Implementation(config));
        }
Esempio n. 2
0
 public static byte[] CalculateCRC(byte[] data, ICRCConfig checksumType)
 {
     var function =  CRCFactory.Instance.Create(checksumType);
     IHashValue value = function.ComputeHash(data);
     return value.Hash;
 }
Esempio n. 3
0
 public static byte[] GetCRC(byte[] value, ICRCConfig crcConfig)
 {
     return(CRCFactory.Instance.Create(crcConfig).ComputeHash(value).Hash);
 }