Core Function Hash

From Sputnik Wiki
Jump to: navigation, search
Hash( <expression> )

Contents

Description

Generate a unique hash code for a string value

Parameters

expression

The expression to compute the hash of (this will use the string value of a given variable).

Return Value

Success: Returns a number above or below zero.

Failure: Returns 0.

Remarks

This function computes a Int64 hash to provide a bit more uniqueness than a regular Int32 hash.

Example

As you see here both strings produce the same hash yet they were constructed differently.

println("Hash A: " . Hash("Hello") );
 
$lol = "o";
println("Hash B: " . Hash("He" . "ll" . $lol) );

An interesting way to produce a unique Hash

$UniqueID = Hash(@GUID);
say $UniqueID;
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox