Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

HashFNV1a32 ( text ; empty )

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.4  (36 votes)
  Discuss this Custom Function

Vaughan Bromfield, Vaughan Bromfield Design
mailto:vbromfield@optusnet.com.au

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

Sample Input:
HashFNV1a32 ( "contracts" ; "" )
Sample Output:
01011001111001011000000111111111


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Description:

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 <vbromfield@optusnet.com.au> on 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

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

This is my Custom Function and I want to edit it

Discuss:

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

------

Vaughan Bromfield, Sydney, Australia
August 26, 2010 6:12pm

Do you have a CF for the unencryption of this?

Thanks!

P Sanchez, Jacksonville, FL
May 13, 2011 5:59am

sorry, decrypt...

P Sanchez, Jacksonville, FL
May 13, 2011 6:27am

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

Vaughan, Sydney, Australia
May 14, 2011 4:50am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 2 + 4 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. SortList ( theList )
  (Sat, Jun 23, 8:45am)
2. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
3. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
4. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
5. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
6. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
7. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
8. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)

RSS Feed of Custom Functions