Difference between revisions of "Ns sha1"
Jump to navigation
Jump to search
(created) |
m |
||
Line 1: | Line 1: | ||
'''Description''' | '''Description''' | ||
+ | |||
Returns a 40-character, hex-encoded string containing the SHA1 hash of the first argument. | Returns a 40-character, hex-encoded string containing the SHA1 hash of the first argument. | ||
Revision as of 22:26, 2 December 2005
Description
Returns a 40-character, hex-encoded string containing the SHA1 hash of the first argument.
Usage
Example 1:
set sRawPassword "mypassword" set sPassword [ns_sha1 $sRawPassword] ns_adp_puts $sPassword # 04003622EB9D0F788CE7568C7EED23809534365A
Usually this function is used with a salt, as without a salt it is succeptible to dictionary-based attacks.
Example 2:
set sSalt "salty" set sRawPassword "mypassword" set sPassword [ns_sha1 ${sRawPassword}${sSalt}] # B48FB74597C11FC609DBE912992085EB07847FB6
This function is provided by the nssha1 module.