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.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

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 1 + 7 =
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. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions