up

Keygen

Available algorithm

command:ns_mhash keygen algorithms
result:list of available key generator algorithms
example:[ns_mhash keygen algorithms]=<%=[ns_mhash keygen algorithms]%>

algorithm capability

command:ns_mhash keygen capability algorithm_name
parameters:algorithm_name - name of keygen algorithm: HEX, ASIS, S2K_SALTED, ...
result:list of capability for algorithm_name
result description: • 0. index of list ([lindex 0 $result]) - 1 if specified keygen algorithm needs a salt or 0.
• 1. index of list ([lindex 1 $result]) - Size of salt. If it is 0, then there is no limitation in the size of salt.
• 2. index of list ([lindex 2 $result]) - Maximum size of the key, that the keygen algorithm may produce. If it is 0, then there is no limitation in the size.
• 3. index of list ([lindex 3 $result]) - 1 if the specified keygen algorithm hashs repeatedly the password or 0.
• 4. index of list ([lindex 4 $result]) - Number of the hash algorithms the keygen algorithm will use. If it is 0 then no hash algorithm is used by the keygen algorithm.
example:[ns_mhash keygen capability S2K_SALTED]=<%=[ns_mhash keygen capability S2K_SALTED]%>

key create

command:ns_mhash keygen create ?-base64|-bin? algorithm_name password list_of_hash_algorithm_name size_of_output_key ?count_of_repeated_hash? ?salt_string?
parameters: ?-bin|-base64? - type of output format for generated key :: default: hexadecimal string; binary (TclByteArray): -bin; binary base64 encoded: -base64
algorithm_name - name of keygen algorithm: HEX, ASIS, S2K_SALTED, ...
password - input string
list_of_hash_algorithm_name - list of hash algorithms used by keygen algorithm
size_of_output_key - size of output generated key
?count_of_repeated_hash? - count how many the keygen algorithm hashs repeatedly the password
?salt_string? - salt used by keygen algorithm
result:key generated by specified keygen algorithm from password
example: [ns_mhash keygen create -base64 MCRYPT "Hello world" [list MD5] 10 ]=<%=[ns_mhash keygen create -base64 MCRYPT "Hello world" [list MD5] 10 ]%>
[ns_mhash keygen create MCRYPT "Hello world" [list MD5] 10 ]=<%=[ns_mhash keygen create MCRYPT "Hello world" [list MD5] 10 ]%>
[ns_mhash keygen create S2K_SALTED "Hello world" [list SHA1] 20 0 "salt"]=<%=[ns_mhash keygen create S2K_SALTED "Hello world" [list SHA1] 20 0 "salt"]%>