This shows you the differences between two versions of the page.

— |
fuss:hash_functions [2017/02/22 18:30] (current) |
||
---|---|---|---|

Line 1: | Line 1: | ||

+ | ====== About ====== | ||

+ | This section is a collection of various hash functions for various datatypes to be hashed. The procedure of creating a hash function is usually additive/multiplicative or rotative. | ||

+ | |||

+ | ===== Additive or Multiplicative Hashing ===== | ||

+ | |||

+ | Additive or multiplicative hashing combines data by either performing an addition or multiplication sequentially by the number of elements in the input. The calculation done on an element value is usually in the form of a multiplication by a prime number. | ||

+ | |||

+ | For example, sequentially adding or multiplying each composition of every element of the input with a prime number: | ||

+ | |||

+ | \begin{eqnarray*} | ||

+ | h(m) &=& \sum_{i=0}^{|m|} m_{i} \circ p \\ | ||

+ | &or& \\ | ||

+ | h(m) &=& \prod_{i=0}^{|m|} m_{i} \circ p | ||

+ | \end{eqnarray*} | ||

+ | |||

+ | |||

+ | ===== Rotative Hashing ===== | ||

+ | |||

+ | Every element in the input is used to construct the hash but values are put through a process of bitwise shifting which is usually a combination of both left and right shifts with the shift amounts being prime numbers. The result of each pass is added to an accumulator which is passed back as the result. | ||

+ | |||

+ | For example, adding or multiplying each composition of the message shifted left by a prime-number and right by a prime number: | ||

+ | |||

+ | \begin{eqnarray*} | ||

+ | h(m) &=& \sum_{i=0}^{|m|} (m_{i} << p) \circ (m_{i} >> q) \\ | ||

+ | &or& \\ | ||

+ | h(m) &=& \prod_{i=0}^{|m|} (m_{i} << p) \circ (m_{i} >> q) | ||

+ | \end{eqnarray*} | ||

+ | |||

+ | ====== Index ====== | ||

+ | |||

+ | {{indexmenu>fuss/hash_functions}} |

fuss/hash_functions.txt ยท Last modified: 2017/02/22 18:30 (external edit)

For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.