HASH

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Core Language > BuiltIn Functions > Numeric functions >

HASH

 

Description

 

Calculates a hash value of a given string key using different hash functions.

A hash function is a reproducible method of turning some kind of data (string) into a (relatively) small number that may serve as a digital "fingerprint" of the data.

 

Syntax

 

n = HASH (HashType, sKey [, MaxValue])

 

Returns

 

Number between 1 and %MAXDWORD

 

Parameters

 

Name

Type

Optional

Meaning

HashType

Numeric

No

You can choose from 2 different type of hash algorithm. Indicate here 1 or 2. Both algorithms try to return the best distributed value.

sKey

String

No

String expression

MaxValue

Numeric

Yes

Optional maximum value you want the function to return. If present, MaxValue will be used to compound the MOD of the returning value.

 

Remarks

 

More info can be found here: http://en.wikipedia.org/wiki/Hash_function

 

Restrictions

 

If sKey is an empty string, zero will be returned.

 

See also

 

Examples