Applies the hash algorithm you select to an ASCII password string and returns a quadword hash value that represents the encrypted password. Format SYS$HASH_PASSWORD pwd ,alg ,[salt] ,usrnam ,hash C Prototype int sys$hash_password (void *pwd, unsigned char alg, unsigned short int salt, void *usrnam, struct _generic_64 *hash);
1 – Arguments
pwd OpenVMS usage: char_string type: character-coded text string access: read only mechanism: by descriptor-fixed-length string descriptor ASCII password string to be encrypted. The pwd argument is the address of a character string descriptor pointing to the ASCII password. The password string can contain between 1 and 32 characters and use the uppercase characters A through Z, the numbers 0 through 9, the dollar sign ($), and the underscore (_). The caller must validate the password string before calling $HASH_PASSWORD to ensure that only permitted characters are included. alg OpenVMS usage: byte_unsigned type: byte (unsigned) access: read only mechanism: by value Algorithm used to hash the ASCII password string. The alg argument is an unsigned byte specifying the hash algorithm. Refer to the HP OpenVMS System Services Reference Manual to view the table of recognized algorithms. Values ranging from 128 to 255 are reserved for customer use; the constant UAI$K_CUST_ALGORITHM defines the start of this range. You can use the UAI$_ENCRYPT and UAI$_ENCRYPT2 item codes with the $GETUAI system service to retrieve the primary and secondary password hash algorithms for a user. salt OpenVMS usage: word_unsigned type: word (unsigned) access: read only mechanism: by value Value used to increase the effectiveness of the hash. The salt argument is an unsigned word containing 16 bits of data that is used by the hash algorithms when encrypting a password for the associated user name. The $GETUAI item code UAI$_SALT is used to retrieve the SALT value for a given user. If you do not specify a SALT value, $HASH_PASSWORD uses the value of 0. usrnam OpenVMS usage:char_string type: character-coded text string access: read only mechanism: by descriptor-fixed-length string descriptor Name of the user associated with the password. The usrnam argument is the address of a descriptor pointing to a character text string containing the user name. The current password encryption algorithm (UAI$C_PURDY_S) folds the user name into the ASCII password string to ensure that different users with the same password produce different hash values. This argument must be supplied for all calls to $HASH_PASSWORD but is ignored when using the CRC algorithm (UAI$C_AD_II). hash OpenVMS usage:quadword_unsigned type: quadword (unsigned) access: write only mechanism: by reference Output hash value representing the encrypted password. The hash argument is the address of an unsigned quadword to which $HASH_ PASSWORD writes the output of the hash. If you use the UAI$C_AD_ II algorithm, the second longword of the hash is always set to 0.