A module for Fowler–Noll–Vo (FNV) hashing
Implements the FNV 1a algorithm for 32bit hashes
Supports hashing of: - 32bit integers (scalar & 1D array) - 64bit integers (scalar & 1D array) - character(*), default kind
The lack of unsigned arithmetic in Fortran means that 64bit arithmetic is needed to perform 32bit hashing. Hashes are therefore returned as int64.
Generic interface to perform hashing
Usage:
fnv_1a([seed],input)
where input is any of the supported types
Hash a single default kind character variable
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | input |
Hash a character(*) string of default kind
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | seed | |||
| character(len=*), | intent(in) | :: | input |
Hash a single 32bit integer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | input |
Hash a single 32bit integer with a starting seed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | seed | |||
| integer(kind=int32), | intent(in) | :: | input |
Hash a 1D array of 32bit integers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | input(:) |
Hash a 1D array of 32bit integers with a starting seed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | seed | |||
| integer(kind=int32), | intent(in) | :: | input(:) |
Hash a single 64bit integer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | input |
Hash a single 64bit integer with a starting seed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | seed | |||
| integer(kind=int64), | intent(in) | :: | input |
Hash a 1D array of 64bit integers
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | input(:) |
Hash a 1D array of 64bit integers with a starting seed
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | seed | |||
| integer(kind=int64), | intent(in) | :: | input(:) |
Help fcn to convert hash to hex representation
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | hash_value |