Commit 80f575b7 authored by Aamir Khan's avatar Aamir Khan Committed by David Chase

hash/crc32: clarify documentation

Explicitly specify that we represent polynomial in reversed notation

Fixes #8229

Change-Id: Idf094c01fd82f133cd0c1b50fa967d12c577bdb5
Reviewed-on: https://go-review.googlesource.com/9237Reviewed-by: default avatarDavid Chase <drchase@google.com>
parent 7579867f
...@@ -5,6 +5,18 @@ ...@@ -5,6 +5,18 @@
// Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32, // Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32,
// checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for // checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for
// information. // information.
//
// Polynomials are represented in LSB-first form also known as reversed representation.
//
// LSB-first representation is a hexadecimal number with n bits, the most
// significant bit represents the coefficient of x^0 and the least significant
// bit represents the coefficient of x^(n-1).
//
// For example, x^5 + x^2 + x^0 is (binary:10100, hexadecimal:0x14) in 5-bit LSB-first form,
// as opposed to (binary:00101, hexadecimal:0x05) in MSB-first (normal) form.
//
// See http://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks#Reversed_representations_and_reciprocal_polynomials
// for information.
package crc32 package crc32
import ( import (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment