]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/doc/hash.txt
Daemon: Let daemon actions be numbered from 1
[libucw.git] / ucw / doc / hash.txt
index 22459c1ca4c516294394dbb769cf20caee16bdbf..788a382c3730c202df7581c31ccc9d3acdac170d 100644 (file)
@@ -1,26 +1,42 @@
 Hashing routines
 ================
 
-Libucw contains two cryptographic hash algorithms: MD5 (RFC 1321) and SHA1 (RFC
-3174).
+LibUCW contains implementations of several hash algorithms.
 
-- <<md5,MD5>>
-- <<sha1,SHA1>>
+<<crypto,Cryptographic hashes>>:
+
+- <<md5,MD5>> (RFC 1321)
+- <<sha1,SHA1>> (RFC 3174)
+- <<hash:sha1_hmac(),SHA1_HMAC message authentication>> (RFC 2104)
 - <<usage,Common usage>>
 
+<<checksum,Checksums>>:
+
+- <<crypto:adler,Adler-32>>
+- <<crc,CRC>>
+
+<<nocrypto,Non-cryptographic hashes>>:
+
+- <<strhash,String & block hashes>>
+- <<inthash,Integer hashes>>
+
+[[crypto]]
+Cryptographic hashes
+--------------------
+
 [[md5]]
 MD5
----
+~~~
 !!ucw/md5.h
 
 [[sha1]]
 SHA1
-----
+~~~~
 !!ucw/sha1.h
 
 [[usage]]
-Usage
------
+Common usage
+~~~~~~~~~~~~
 
 There are two ways you can use the hashing routines.
 
@@ -48,3 +64,39 @@ There are two ways you can use the hashing routines.
 SHA1 has the same interface, so the same two ways apply.
 
 See also <<string:mem_to_hex()>>.
+
+[[checksum]]
+Checksums
+---------
+
+Their purpose is checking against random data changes, hardware
+failures and alike. They are not to be used against aimed attacks.
+
+Adler-32
+~~~~~~~~
+
+The <<compress:adler,Adler-32 checksum>> is documented in the
+<<compress:,compression capter>>.
+
+CRC-32
+~~~~~~
+
+32-bit Cyclic Redundancy Check with the polynomial suggested by
+Castagnoli et al.: Optimization of Cyclic Redundancy-Check Codes
+with 24 and 32 Parity Bits", IEEE Trans. on Communications, Vol. 41,
+No. 6, 1993.
+
+The interface is similar to the one we use for the cryptographic hashes.
+
+!!ucw/crc.h
+
+[[nocrypto]]
+Non-cryptographic hashes
+------------------------
+
+They are usually used to identify values in hash tables.
+
+All these functions expect to be moduled by the size of a hash table.
+The size should be a prime number (it gives better distribution).
+
+!!ucw/hashfunc.h