aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAamir Khan <syst3m.w0rm@gmail.com>2015-04-22 19:24:48 +0900
committerDavid Chase <drchase@google.com>2015-04-24 13:44:25 +0000
commit80f575b78fceeba3ab5ec5a5f08b26725734b341 (patch)
tree485c2004639f6f84b7d87dddeaf7df588c0bf181 /src
parent7579867fece7e42b38d69eca202182f5de786390 (diff)
downloadgo-80f575b78fceeba3ab5ec5a5f08b26725734b341.tar.xz
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/9237 Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/hash/crc32/crc32.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/hash/crc32/crc32.go b/src/hash/crc32/crc32.go
index 6a6b9473be..4b13c12d32 100644
--- a/src/hash/crc32/crc32.go
+++ b/src/hash/crc32/crc32.go
@@ -5,6 +5,18 @@
// Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32,
// checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for
// 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
import (