# HashFNV1a32 ( text ; empty )

Computes the 32 bit binary FNV-1a has for the input text.

Average rating: 4.5 (34 votes) Log in to vote

Vaughan Bromfield |

Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

HashFNV1a32 ( text ; empty )

The initial value for "empty" must be empty ("")

This function computes the 32-bit binary hash for the input text based on the FNV-1a algorithm

This function requires the following functions:

Bin2dec ( bin ; empty )

Dec2bin ( decimalNumber ; empty )

XORbin ( bin0 ; bin1 ; empty )

This custom function was written by Vaughan Bromfield

This function is based on the algorithm published at:

http://www.isthe.com/chongo/tech/comp/fnv/index.html

http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash

## Comments

Vaughan Bromfield Aug 26, 2010 |
||

Here is an updated version of the function that uses a local variable instead of the second parameter. It should AFAIK produce the same results. ------ // HashFNV1a32 ( text ) // // This function computes the 32-bit binary hash // for the input text based on the FNV-1a algorithm // // This function requires the following functions: // Bin2dec() // Dec2bin() // XORbin() // // This custom function was written by Vaughan Bromfield // vbromfield@optusnet.com.au // 14 March 2010 // // This function is based on the algorithm published at: // http://www.isthe.com/chongo/tech/comp/fnv/index.html // http://en.wikipedia.org/wiki/Fowler_Noll_Vo_hash // // The local $variable is used to carry the result to the next recursion instead of a function parameter. Case ( Length( text ) = 0 ; Let( [ result = $_hash_HashFNV1a32 ; $_hash_HashFNV1a32 = "" ] ; result ) ; // return result, clear local variables Let( [ offset = 2166136261 ; prime = 16777619 ; chr = Right ( text ; 1 ) ; nextxt = Left ( text ; Length( text ) - 1 ) ; hash0 = If( IsEmpty( $_hash_HashFNV1a32 ) ; Dec2Bin( offset ) ; $_hash_HashFNV1a32 ) ; hash1 = XORbin( hash0 ; Dec2Bin( Code( chr ) ) ) ; $_hash_HashFNV1a32 = Right( "00000000000000000000000000000000" & Dec2Bin( Mod( Bin2Dec( hash1 ) * prime ; 4294967296 ) ) ; 32 ) ] ; HashFNV1a32 ( nextxt ) // recurse ) //end let ) //end case ------ |
||

P Sanchez, Jacksonville, FL May 13, 2011 |
||

Do you have a CF for the unencryption of this? Thanks! |
||

P Sanchez, Jacksonville, FL May 13, 2011 |
||

sorry, decrypt... | ||

Vaughan, Sydney, Australia May 14, 2011 |
||

This is a hash function. There is no way to "decrypt" a hash function. Hash functions are not reversible. | ||

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.