Difference between revisions of "Nssha1"
Jump to navigation
Jump to search
(Added salted example.) |
(added configuration and better description of the function.) |
||
Line 1: | Line 1: | ||
− | The nssha1 module provides the ns_sha1 function | + | The nssha1 module provides the ns_sha1 function, which returns a 40-character, hex-encoded string containing the SHA1 hash of the first argument. |
− | Example: | + | Example 1: |
<pre> | <pre> | ||
Line 11: | Line 11: | ||
Usually this function is used with a salt, as without a salt it is succeptible to dictionary-based attacks. | Usually this function is used with a salt, as without a salt it is succeptible to dictionary-based attacks. | ||
+ | |||
+ | Example 2: | ||
<pre> | <pre> | ||
Line 18: | Line 20: | ||
# B48FB74597C11FC609DBE912992085EB07847FB6 | # B48FB74597C11FC609DBE912992085EB07847FB6 | ||
</pre> | </pre> | ||
+ | |||
+ | '''Installation''' | ||
Debian users can install this module for aolserver4 with: | Debian users can install this module for aolserver4 with: | ||
<pre>apt-get install aolserver4-nssha1</pre> | <pre>apt-get install aolserver4-nssha1</pre> | ||
+ | |||
+ | '''Configuration''' | ||
+ | |||
+ | ns_section "ns/server/${servername}/modules" | ||
+ | ns_param nssha1 nssha1.so |
Revision as of 22:24, 2 December 2005
The nssha1 module provides the ns_sha1 function, which returns a 40-character, hex-encoded string containing the SHA1 hash of the first argument.
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
Installation
Debian users can install this module for aolserver4 with:
apt-get install aolserver4-nssha1
Configuration
ns_section "ns/server/${servername}/modules" ns_param nssha1 nssha1.so