1 \ 2\0/*%
\0 * VAX/VMS Password hashing routines:
\0\ 2\0 *,
\0 * uses the System Service SYS$HASH_PASSWORD
\ 2\0 *
\ 3\0 */
\0\0\0\13\0#include <syidef.h>
\0\14\0#include <descrip.h>
\0\0\ 2\0/*
\12\0 * Hashing routine
\ 3\0 */
\0R
\0hash_vms_password(output_buf,input_buf,input_length,username,encryption_type,salt)
\11\0char *output_buf;
\0\10\0char *input_buf;
\11\0int input_length;
\0\ f\0char *username;
\0\14\0int encryption_type;
\14\0unsigned short salt;
\ 1\0{
\0"
\0 struct dsc$descriptor_s password;
\1e\0 struct dsc$descriptor_s user;
\0\0\ 3\0 /*
\0:
\0 * Check the VMS Version. If this is V5.4 or later, then?
\0 * we can use the new system service SYS$HASH_PASSWORD. Else
\0\1d\0 * fail and return garbage.
\0\ 4\0 */
\0\0\16\0 char VMS_Version[32];
\0 struct {
\0\1a\0 unsigned short int Size;
\1a\0 unsigned short int Code;
\ f\0 char *Buffer;
\0%
\0 unsigned short int *Resultant_Size;
\09
\0 } Item_List[2]={32, SYI$_VERSION, VMS_Version, 0, 0, 0};
\0&
\0 struct {int Size; char *Ptr;} Descr1;
\0\0\ 3\0 /*
\0\17\0 * Get the information
\0\ 4\0 */$
\0 SYS$GETSYIW(0,0,0,Item_List,0,0,0);
\ 3\0 /*
\07
\0 * Call the old routine if this isn't V5.4 or later...
\0\ 4\0 */
\1e\0 if ((VMS_Version[1] < '5') ||9
\0 ((VMS_Version[1] == '5') && (VMS_Version[3] < '4')))
\0\ f\0 return(1);
\0\ 3\0 /*
\00
\0 * Call the SYS$HASH_PASSWORD system service...
\ 4\0 */&
\0 password.dsc$b_dtype = DSC$K_DTYPE_T;-
\0 password.dsc$b_class = DSC$K_CLASS_S;
\0-
\0 password.dsc$w_length = input_length;
\0$
\0 password.dsc$a_pointer = input_buf;"
\0 user.dsc$b_dtype = DSC$K_DTYPE_T;"
\0 user.dsc$b_class = DSC$K_CLASS_S;&
\0 user.dsc$w_length = strlen(username);
\1f\0 user.dsc$a_pointer = username;
\0I
\0 sys$hash_password (&password, encryption_type, salt, &user, output_buf);
\0\ 1\0}
\0\0\0