A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Module: crypt

Support hash algorithms. The module must be loaded with dl('crypt');

See also example Hash algorithms.

Function/Arguments Return Description
crypt (string text [, string salt]) string Crypt a given text with integrated hash algorithms and optional salt. Crypted string will be returned. This function is full compatible with PHP crypt (). Integrated algorithms: DES, MD5, Blowfish, SHA256, SHA512
md5 (string text [, bool rawOutput=false]) string Create MD5 hash of given text. Crypted string will be returned. If rawOutput is true, then the string is returned as binary data. This function is full compatible with PHP md5 ().
sha1 (string text [, bool rawOutput=false]) string Create SHA1 hash of given text. Crypted string will be returned. If rawOutput is true, then the string is returned as binary data. This function is full compatible with PHP sha1 ().
hash_algos () array Return array of integrated hash algorithms for the hash_xxx () functions. For example array ("md5","sha1","sha256","sha512")
hash_init (string algorithm) handle Initialize a hash algorithm. See function hash_algos () for available algorithms. On success a handle is returned which can be used in hash functions, on error false is returned.
hash_update (handle handle, string data) bool Update the hash of data with hash algorithm handle. On success true is returned.
hash_finish (handle handle [, bool rawOutput=false]) string Return the calculated hash of hash algorithm handle. If rawOutput is true, then the string is returned as binary data. On error false is returned. The handle will be destroyed and cannot be used again.
hash_file (string algorithm, string file [, bool rawOutput=false]) string Return the calculated hash of a file with a specific hash algorithm. See function hash_algos () for available algorithms. If rawOutput is true, then the string is returned as binary data. On error false is returned.

back to Home