Questions tagged [fnv]

Fowler–Noll–Vo is a non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Phong Vo.

From Wikipedia page on Fowler–Noll–Vo hash function

The current versions are FNV-1 and FNV-1a, which supply a means of creating non-zero FNV offset basis. FNV currently comes in 32-, 64-, 128-, 256-, 512-, and 1024-bit flavors. For pure FNV implementations, this is determined solely by the availability of FNV primes for the desired bit length; however, the FNV webpage discusses methods of adapting one of the above versions to a smaller length that may or may not be a power of two.

21 questions
10
votes
1 answer

C# implementation of FNV Hash

I have had numerous cases where I need access to a decent hashing algorithm in C#, from overriding GetHashCode to performing quick comparisons/lookups against data. I have found the FNV hash to be a really easy/good/quick hash algorithm. However, I…
Keith
  • 1,119
  • 2
  • 12
  • 23
5
votes
4 answers

Objective-C : Fowler–Noll–Vo (FNV) Hash implementation

I have a HTTP connector in my iPhone project and queries must have a parameter set from the username using the Fowler–Noll–Vo (FNV) Hash. I have a Java implementation working at this time, this is the code : long fnv_prime = 0x811C9DC5; long hash =…
Dough
  • 515
  • 1
  • 6
  • 20
4
votes
1 answer

Is there a mature implementation of the FNV hashing algorithm in Java?

I've seen the Fowler-Noll-Vo (FNV) recommended as a good choice for a fast hashing algorithm for use in our implementation of a consistent hashing system. Can't seem to locate a good Java source for it though.
justinhj
  • 11,147
  • 11
  • 58
  • 104
4
votes
2 answers

FNV 'flavors' and PHP implementation

I'm trying to integrate FNV hashing algorithm on a PHP-based project as part of a requirement to produce hashes for a variety of data (e.g. URLs, keywords). I saw this implementation by Neven Boyanov. He mentioned that due to arithmetic limitations…
PJ.
  • 1,196
  • 2
  • 12
  • 25
2
votes
1 answer

fnv 0.2.0 Usage TypeError

I am trying to use fnv hash function on python-3.6, but I am getting an error Traceback (most recent call last): File "C:/Users/SACHIN/AppData/Local/Programs/Python/Python36/bloom.py", line 4, in module fnv.hash(data, algorithm=fnv.fnv_1a,…
sachin rathod
  • 541
  • 1
  • 9
  • 23
2
votes
4 answers

Static Pseudorandom field generator

I'm running into an issue with the random number generator I wrote for a game. I need a fast pseudorandom field generator. It does not need to be cryptographically secure, it just needs to take in a vector and a seed, and give a hashed value…
OmnipotentEntity
  • 16,531
  • 6
  • 62
  • 96
1
vote
1 answer

FNV hashing for strings in C

Here is what the algorithm says. hash = FNV_offset_basis for each octet_of_data to be hashed hash = hash * FNV_prime hash = hash XOR octet_of_data return hash but if i have a set of strings then what shall i take as the FNV_offset_basis,…
Kraken
  • 23,393
  • 37
  • 102
  • 162
1
vote
1 answer

How to iterate through FnvHashMap in Rust

I have two FnvHashMap which is declared like first: FnvHashMap<(i32, i32), Employee> second: FnvHashMap<(i32, i32), Employee> Where Employee is pub struct Employee { pub emp_id: i32, pub lang_id: i32, pub dept_id: f64, pub…
Ann
  • 31
  • 1
  • 6
1
vote
0 answers

Using a System.Guid as an Integer

I'm playing around with FNV-1a hashing. I have a very simple implementation, which seems to work very well for 32 bit hashes and 64 bit hashes: const ulong FNV_PRIME = 0x00000100000001B3; const ulong FNV_OFFSETBASIS = 0xCBF29CE484222325; ulong hash…
Rainmaker
  • 173
  • 3
  • 13
1
vote
0 answers

values for MAD compression method?

I am stuck trying to implement the perfect hashing technique using universal hashing at each level from Cormen. Specifically, with the compression method (at least, I think here is my problem). I am working on strings, I think short strings (between…
germelcar
  • 56
  • 6
1
vote
3 answers

Implementation of FNV

I am trying to implement FNV hash from http://isthe.com/chongo/tech/comp/fnv/ I converted the PowerBasic's inline asm on that page into Delphi. function ReadFileToMem(sPath:string):Pointer; var hFile: THandle; pBuffer: Pointer; …
user
  • 681
  • 3
  • 10
  • 19
1
vote
1 answer

FNV1A_64 don't match

I'm trying 3 different implementation of FNV1A_64 hash. 1) Maatkit SELECT FNV1A_64('1') Result: -5808609649712063748 2) pyhash import pyhash hasher = pyhash.fnv1a_64() print hasher('1') Result: 53876069782339L 3) fnv ./fnv1a64 -s 1 Result:…
artyomboyko
  • 2,781
  • 5
  • 40
  • 54
0
votes
0 answers

Impala fnv_hash() result not matching the one in Python fnv library

I'm using Impala 3.2.0, and when I run fnv_hash(), I can't seem to be able to match the value with the fnv hash I get using Python, may I know why? select fnv_hash('test') 7063314956707709637 !pip install fnv import fnv fnv.hash(b'test',…
Jackie
  • 1
  • 1
0
votes
1 answer

Trucating FNV hash

I'm using 32-bit FNV-1a hashing, but now I want to reserve one of the bits to hold useful information about the input key. That is, I want to use only 31 of the 32 bits for hash and 1 bit for something else. Assuming FNV is well distributed for my…
codechimp
  • 1,509
  • 1
  • 14
  • 21
0
votes
3 answers

Porting FNV-1a algorithm from C# to Lua, multiplication result don't match

I'm trying to port the Accidental Noise library from C# to Lua. I encounter an issue when trying to port the FNV-1A algorithm. The result of the multiplication with the prime doesn't match when using same input values. First I'd like to show the C#…
Wolfgang Schreurs
  • 11,779
  • 7
  • 51
  • 92
1
2