summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-10-02 14:05:29 +0200
committerantirez <antirez@gmail.com>2011-10-02 14:05:29 +0200
commit13c7e5ef299f4f6b38cd81c924bdf3eca691d691 (patch)
treeede11599373793855897db9cbe5ae1675a0630f9
parent66c146592a0c0ff39570633811008cee8773233e (diff)
downloadredis-13c7e5ef299f4f6b38cd81c924bdf3eca691d691.tar.gz
Exact variant of CRC16 specified into crc16.c
-rw-r--r--src/crc16.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/crc16.c b/src/crc16.c
index 37fb4ca77..6ba7f2448 100644
--- a/src/crc16.c
+++ b/src/crc16.c
@@ -28,7 +28,20 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* CRC16 implementation acording to CCITT standards */
+/* CRC16 implementation acording to CCITT standards.
+ *
+ * Note by @antirez: this is actually the XMODEM CRC 16 algorithm, using the
+ * following parameters:
+ *
+ * Name : "XMODEM", also known as "ZMODEM", "CRC-16/ACORN"
+ * Width : 16 bit
+ * Poly : 1021 (That is actually x^16 + x^12 + x^5 + 1)
+ * Initialization : 0000
+ * Reflect Input byte : False
+ * Reflect Output CRC : False
+ * Xor constant to output CRC : 0000
+ * Output for "123456789" : 31C3
+ */
static const uint16_t crc16tab[256]= {
0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,