Go to the first, previous, next, last section, table of contents.


secureHashFixnum

Function: secureHashFixnum { string -> fixnum }
file: job.t
package: muf
status: alpha

This function is identical to secureHash except that the result is returned as a single nonnegative fixnum (small integer), instead of a string.

CAVEAT PROGRAMMER: Since the normal secureHash return value contains 160 bits, and a nonnegative Muq fixnum contains only 62 bits, this is much less secure: Use in authentication is not recommended.

However, if you just want a quick and easy way of reducing a string to an efficient integer form, secureHashFixnum may be just the ticket.

The specific application I had in mind when introducing this was procedurally defined worlds in which a room is defined by a canonical path string for it looking something like (say) "north;west;north;up..." -- a fixnum hash of this canonical name may then be an excellent basis from which to generate name and contents for the room:

[ "Alice's Acres" "Barb's BAR-B-Q" "Carol's Chalet" | ]vec --> names
Stack:
"n;s;e;w" secureHashFixnum
Stack: 3030486389481771550
3 % --> h
Stack:
names[h]
Stack: "Barb's BAR-B-Q"

See section hash. See section |secureHash. See section |secureDigest. See section |secureHashCheck. See section secureHash. See section secureHashBinary.


Go to the first, previous, next, last section, table of contents.