Please enable JavaScript to view this site.

A-Shell Development History

New subroutine for generating a hash code from a string of characters:

xcall HASH, hashtype, key, cbkey, hash, status

hashtype specifies the type of hash to generate. Currently there are only two possibilities: 1=ELF, 2=DJB. ELF is one of the most commonly used hash algorithms in the UNIX world, and is tweaked for 32 bit processors. DJB (named after its creator Dan J. Bernstein) is thought to be one of the most efficient hash algorithms and is thought to work work well on very short keys, but may is considered somewhat weaker then the ELF algorithm (i.e. more likely to generate the same hash from different keys) when it comes to avalanche and permutation.

Parameter

Type

I/O

Description

hashtype

Num

in

1=ELF, 2=DJB. See above

key

String or X

in

the source data from which the hash will be calculated. It can be any length.

cbkey

Num

in

optionally specifies the number of bytes to be considered in key. If 0, key is processed up to the first null byte or its physical length.

hash

String,8+ or b,4

out

the generated hash. If string (8+ bytes), then it will be returned as 8 hex digits. If b,4, it will be returned as a 32 bit value.

status

Signed Num

out

indicates success or failure:

>=0

success

-1

bad key type

-2

bad hash type

-3

bad has data type of size