2 * VAX/VMS Password hashing routines:
4 * uses the System Service SYS$HASH_PASSWORD
6 * Permission to use, copy, modify, distribute, and sell this software and its
7 * documentation for any purpose is hereby granted without fee, provided that
8 * the above copyright notice appear in all copies and that both that
9 * copyright notice and this permission notice appear in supporting
10 * documentation. No representations are made about the suitability of this
11 * software for any purpose. It is provided "as is" without express or
23 hash_vms_password(output_buf,input_buf,input_length,username,encryption_type,salt)
31 struct dsc$descriptor_s password;
32 struct dsc$descriptor_s user;
35 * Check the VMS Version. If this is V5.4 or later, then
36 * we can use the new system service SYS$HASH_PASSWORD. Else
37 * fail and return garbage.
40 static char VMS_Version[32];
42 unsigned short int Size;
43 unsigned short int Code;
45 unsigned short int *Resultant_Size;
46 } Item_List[2]={32, SYI$_VERSION, VMS_Version, 0, 0, 0};
47 struct {int Size; char *Ptr;} Descr1;
52 sys$getsyiw(0,0,0,Item_List,0,0,0);
54 * Call the old routine if this isn't V5.4 or later...
57 if ((VMS_Version[1] < '5') ||
58 ((VMS_Version[1] == '5') && (VMS_Version[3] < '4'))) {
59 printf("Unsupported OS version\n");
64 * Call the SYS$HASH_PASSWORD system service...
66 password.dsc$b_dtype = DSC$K_DTYPE_T;
67 password.dsc$b_class = DSC$K_CLASS_S;
68 password.dsc$w_length = input_length;
69 password.dsc$a_pointer = input_buf;
70 user.dsc$b_dtype = DSC$K_DTYPE_T;
71 user.dsc$b_class = DSC$K_CLASS_S;
72 user.dsc$w_length = strlen(username);
73 user.dsc$a_pointer = username;
74 sys$hash_password (&password, encryption_type, salt, &user, output_buf);