JMS@ARIZMIS.BITNET.UUCP (02/01/87)
HPWD.MAR is, in itself, copyright Digital Equipment Corporation, and it's
uncertain that sending it out over the net would be legal. But who
cares really? In any case, here is a version in Fortran that only
supports one of the encryption algorithms :
Call Hash_Password (sysuaf_record,password_string(1:i),
c UAF$Q_PWD,UAF$B_ENCRYPT,i)
Subroutine Hash_Password(sysuaf_record,UAF$element,offset,
c offset_encrypt,password_size)
Implicit none
* The AUTODIN-II CRC polynomial is used.
Include 'SUAF$.INC'
Character*64 UAF$element
integer*4 password_size
Integer*4 offset,offset_encrypt
Integer*4 lib$crc,lib$crc_table,istat
Integer*4 Poly_mask
Integer*4 crc_table(16)
Integer*4 init_value
integer*4 i
integer*4 pwd_long
byte pwd_temp(4)
Equivalence (pwd_long,pwd_temp(1))
** Set up the mask and initial CRC value for the Autodin-II polynomial
poly_mask = 'edb88320'X
init_value = -1
** Generate the CRC table
istat = lib$crc_table(poly_mask,crc_table)
crc_table(1) = '00000000000'O
crc_table(2) = '03555610144'O
crc_table(3) = '07333420310'O
crc_table(4) = '04666230254'O
crc_table(5) = '16667040620'O
crc_table(6) = '15332650764'O
crc_table(7) = '11554460530'O
crc_table(8) = '12001270474'O
crc_table(9) = '35556101440'O
crc_table(10) = '36003711504'O
crc_table(11) = '32665521750'O
crc_table(12) = '31330331614'O
crc_table(13) = '23331141260'O
crc_table(14) = '20664751324'O
crc_table(15) = '24002561170'O
crc_table(16) = '27557371034'O
** Hash the password
10 pwd_long = lib$crc(crc_table,init_value,
c UAF$element(1:password_size))
sysuaf_record(%loc(offset)+1) = pwd_temp(1)
sysuaf_record(%loc(offset)+2) = pwd_temp(2)
sysuaf_record(%loc(offset)+3) = pwd_temp(3)
sysuaf_record(%loc(offset)+4) = pwd_temp(4)
sysuaf_record(%loc(offset)+5) = 0
sysuaf_record(%loc(offset)+6) = 0
sysuaf_record(%loc(offset)+7) = 0
sysuaf_record(%loc(offset)+8) = 0
sysuaf_record(%loc(offset_encrypt)+1) = 0
return
+-------------------------------+
| Joel M Snyder | BITNET: jms@arizmis.BITNET
| Univ of Arizona Dep't of MIS | ArizoNET: MRSVAX::JMS
| Tucson, Arizona 85721 | Pseudo-PhoneNET: (602) 621-2748
+-------------------------------+
(std. disclaimer in re: nobody taking anything I say seriously)