Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Crc32"/> class.
 /// </summary>
 public Crc32()
 {
     this.table = Crc32.InitializeTable(Crc32.DefaultPolynomial);
     this.seed  = Crc32.DefaultSeed;
     this.hash  = this.seed;
 }
Exemplo n.º 2
0
 /// <summary>
 /// When overridden in a derived class, finalizes the hash computation after the last data is processed by the cryptographic stream object.
 /// </summary>
 /// <returns>The computed hash code.</returns>
 protected override byte[] HashFinal()
 {
     byte[] hashBuffer = Crc32.UIntToBigEndianBytes(~this.hash);
     this.HashValue = hashBuffer;
     return(hashBuffer);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Hashes the core.
 /// </summary>
 /// <param name="array">The buffer.</param>
 public uint CalculateHash2(byte[] array)
 {
     return(Crc32.CalculateHash(this.table, this.hash, array, 0, array.Length));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Hashes the core.
 /// </summary>
 /// <param name="array">The buffer.</param>
 /// <param name="start">The start.</param>
 /// <param name="length">The length.</param>
 protected override void HashCore(byte[] array, int start, int length)
 {
     this.hash = Crc32.CalculateHash(this.table, this.hash, array, start, length);
 }