Cold Help System: Programming: ColdC Reference Manual: Functions: String: crypt()


STRING crypt(STRING str[, STRING salt])

This function performs one-way encryption on str, using the SHA encryption routine. If salt is not specified, it is chosen randomly. The return value of crypt() is the encrypted string.

The encryption performed by this function has the property that it is very difficult to find a string which will produce a given result; however, a given string and a given salt will always yield the same encrypted string. Example:

crypt("foo", "ab")
=> "$2$ab$TmSIW.xT3sTkwqUhTLxCH192J37"

When matching an encrypted string versus a non-encrypted string, the function match_crypted() should be used, as it will take into consideration any possible future changes to the crypt() implementation.


crypt() | explode() | lowercase() | match_begin() | match_pattern() | match_regexp() | match_template() | pad() | regexp() | strcmp() | strfmt() | strgraft() | strlen() | strsed() | strsub() | substr() | uppercase() | match_crypted() | split() | stridx()


Tlon