Code - Custom Function
ChecksumAdler32 ( text ; seed1 ; seed2 )
BrianDunning.com, Brian Dunning http://www.briandunning.com/filemaker-custom-functions/list.php
Rate this function: Average rating: 0.0 (0 votes) Discuss this Custom FunctionVaughan Bromfied, Vaughan Bromfield design
http://google.com
Creates a checksum of the input text bases on the Adler-32 algorithm.
==================== SAMPLE INPUT AND OUTPUT ====================
INPUT
ChecksumAdler32 ( "wikipedia" ; 1 ; 0 )
OUTPUT
319161272
==================== DESCRIPTION ====================
ChecksumAdler32 ( text ; seed1 ; seed2 )
The initial values for seed1 and seed2 must be 1 and 0 respectively.
Adler-32 is a checksum algorithm which was invented by Mark Adler.
This custom function was written by Vaughan Bromfield .
This function is based on the algorithm published on the Adler-32 page on Wikipedia (accessed 2010-02-17)
http://en.wikipedia.org/wiki/Adler-32
The published algorithm used ASCII encoding and returns a hexadecimal result; this cf implementation uses Unicode encoding and returns a decimal (base 10) result.
There may be other differences.
All care taken but no responsibility. Your mileage may vary.
==================== CUSTOM FUNCTION ====================
// ChecksumAdler32 ( text ; 1 ; 0 )
// The initial values for seed1 and seed2 must be 1 and 0 respectively.
//
// Adler-32 is a checksum algorithm which was invented by Mark Adler.
// This custom function was written by Vaughan Bromfield
// vbromfield@optusnet.com.au
//
// This function is based on the algorithm published on the
// Adler-32 page on Wikipedia (accessed 2010-02-17)
// http://en.wikipedia.org/wiki/Adler-32
// The published algorithm used ASCII encoding and returns a hexadecimal result;
// this cf uses Unicode encoding and returns a decimal (base 10) result.
// There may be other differences.
Case (
Length( text ) = 0 ; Mod ( seed2 ; 65521 ) * 65536 + Mod ( seed1 ; 65521 ) ;
Let(
[
chr = Left ( text ; 1 ) ;
nextxt = Right ( text ; Length( text ) - 1 ) ;
nextseed1 = seed1 + Code ( chr ) ;
nextseed2 = seed2 + nextseed1
] ;
ChecksumAdler32 ( nextxt ; nextseed1 ; nextseed2 )
) //end let
) //end case
Referring URL: 'http://www.briandunning.com/cf/1122'
Keywords: ''
ClipManager:

