From 1609b4e08a17e1875c7fb87f27955da68111132c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Tue, 18 Aug 2015 10:42:41 +0000 Subject: [PATCH] Cite the Fletcher paper. --- lib/hash/fletcher16.c | 5 ++++- lib/hash/fletcher32.c | 10 ++++++++-- lib/hash/fletcher64.c | 10 ++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/hash/fletcher16.c b/lib/hash/fletcher16.c index 0537aad..a0e6438 100644 --- a/lib/hash/fletcher16.c +++ b/lib/hash/fletcher16.c @@ -37,7 +37,10 @@ #include /* - * Simple implementation of Fletcher's checksum (16-bit version). + * Simple implementation of the 16-bit variant of Fletcher's checksum, + * described in Fletcher, J. G. (January 1982), "An Arithmetic Checksum + * for Serial Transmissions", IEEE Transactions on Communications. COM-30 + * (1): 247–252, doi:10.1109/tcom.1982.1095369 */ uint16_t fletcher16_hash(const void *data, size_t len) diff --git a/lib/hash/fletcher32.c b/lib/hash/fletcher32.c index b5b35ed..5d2c3a5 100644 --- a/lib/hash/fletcher32.c +++ b/lib/hash/fletcher32.c @@ -37,8 +37,14 @@ #include /* - * Simple implementation of Fletcher's checksum (32-bit version). The - * input length is zero-padded to the nearest multiple of 2 bytes. + * Simple implementation of the 32-bit variant of Fletcher's checksum, + * described in Fletcher, J. G. (January 1982), "An Arithmetic Checksum + * for Serial Transmissions", IEEE Transactions on Communications. COM-30 + * (1): 247–252, doi:10.1109/tcom.1982.1095369 + * + * The paper assumes that the input length is a multiple of the checksum + * algorithm's word size (half the checksum size). This implementation + * will zero-pad the input up to the nearest multiple of the word size. */ uint32_t fletcher32_hash(const void *data, size_t len) diff --git a/lib/hash/fletcher64.c b/lib/hash/fletcher64.c index 42fb251..6c67a52 100644 --- a/lib/hash/fletcher64.c +++ b/lib/hash/fletcher64.c @@ -37,8 +37,14 @@ #include /* - * Simple implementation of Fletcher's checksum (64-bit version). The - * input length is zero-padded to the nearest multiple of 4 bytes. + * Simple implementation of the 64-bit variant of Fletcher's checksum, + * described in Fletcher, J. G. (January 1982), "An Arithmetic Checksum + * for Serial Transmissions", IEEE Transactions on Communications. COM-30 + * (1): 247–252, doi:10.1109/tcom.1982.1095369 + * + * The paper assumes that the input length is a multiple of the checksum + * algorithm's word size (half the checksum size). This implementation + * will zero-pad the input up to the nearest multiple of the word size. */ uint64_t fletcher64_hash(const void *data, size_t len)