Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-06 - 43,50374/endecr.mac
There are 9 other files named endecr.mac in the archive. Click here to see a list.
00100	TITLE	ENDECR - ALC STYLE ENCRIPTION SCHEME
00200	
00300		TWOSEG
00400		RELOC	400000
00500	
00600	COMMENT	$
00700	
00800		THE FOLLOWING CODE CONSISTS OF 3 BASIC ROUTINES:
00900	1) CRASZ. - WARMUP ROUTINE FOR ASCIZ SEED
01000	2) CRSIX. - WARMUP ROUTINE FOR A SIXBIT ATOM
01100	3) CRYPT. - BASIC CRYPTION
01200	
01300	CALLING CONVENTIONS:
01400		THESE 3 SUBROUTINES USE AC'S 0-7, ARGUMENTS ARE PASSED
01500	IN 5 , 6 , AND 7  - ANSWERS RETURNED IN 5.
01600	
01700	1)	MOVE	A,<ADDR OF ASCIZ STRING OR BP>
01800		PUSHJ	P,CRASZ.
01900		......		;SEED RETURNED IN (C)
02000	
02100	2)	MOVE	C,<SIXBIT ATOM>
02200		PUSHJ	P,CRSIX.
02300		......		;SEED RETURNED IN (C)
02400	
02500	3)	MOVE	A,<AOBJN WORD TO BLOCK TO BE CRYPTED>
02600		MOVE	B,<BLOCK KEY (BLOCK NUMBER WILL DO)>
02700		MOVE	C,<SEED GENERATED BY CRASZ. OR CRSIX.>
02800		PUSHJ	P,CRYPT.
02900		......		;ALWAYS RETURN
03000	$
03100		ENTRY	CRASZ.,CRSIX.,CRYPT.
03200	
03300	;AC DEF'S
03400	
03500	Z==0
03600	T1==1
03700	T2==2
03800	T3==3
03900	T4==4
04000	C==5
04100	B==6
04200	A==7
04300	P==17
     
00100	;CRASZ. - CONVERTS ASCIZ STRINGS POINTED TO BY (A) INTO SEEDS
00200	
00300	CRASZ.:	TLNN	A,-1		;SEE IF BYTE-PNTR
00400		HRLI	A,(<POINT 7,,>)
00500		MOVEI	B,0
00600		PUSH	P,B
00700	CRASZ1:	MOVEI	C,0
00800		MOVE	T1,[POINT 6,C]
00900	CRASZ2:	ILDB	Z,A
01000		JUMPE	Z,CRASZ3
01100		CAIG	Z,"Z"+40
01200		CAIG	Z," "
01300		JRST	CRASZ2
01400		CAILE	Z,"_"
01500		SUBI	Z,40
01600		SUBI	Z,40
01700		IDPB	Z,T1
01800		TLNE	T1,770000
01900		JRST	CRASZ2
02000		XOR	C,0(P)
02100		PUSHJ	P,CRSIX.
02200		MOVEM	C,0(P)
02300		JRST	CRASZ1
02400	
02500	CRASZ3:	JUMPE	C,CRASZ4
02600		XOR	C,0(P)
02700		PUSHJ	P,CRSIX.
02800		MOVEM	C,0(P)
02900	CRASZ4:	POP	P,C
03000		JUMPN	C,CRASZ5
03100		SKIPE	B
03200		MOVE	C,[13702,,175435]
03300	CRASZ5:	POPJ	P,
03400	
03500	;CRSIZ. - HANDLES SIXBIT ATOMS (CALLED FROM CRASZ.)
03600	
03700	CRSIX.:	JUMPE	C,CRSIX1
03800		PUSHJ	P,CWRAN
03900		HLR	B,B
04000		SUB	P,B
04100	CRSIX1:	POPJ	P,
     
00100	;CRYPT. - BASIC BLOCK EN/DE CRYPTER
00200	
00300	CRYPT.:	JUMPE	C,CRYPT4
00400		MOVE	Z,B
00500		IMULI	Z,200401
00600		AND	Z,[11111111]
00700		MUL	Z,[11111111]
00800		TLZ	T1,(<6B2>)
00900		ADD	C,T1
01000		PUSHJ	P,CWRAN
01100		HLRZ	T1,B
01200		MOVN	T1,T1
01300		HRL	T1,T1
01400		ADDI	T1,1(P)
01500		PUSH	P,T1
01600	CRYPTA:	MOVE	T1,0(P)
01700		HRRZ	T2,B
01800		HRL	T2,T2
01900		ADD	T2,T1
02000	CRYPT1:	MOVE	Z,0(T2)
02100		ADDB	Z,0(T1)
02200		XORM	Z,0(A)
02300		AOBJP	A,CRYPT3
02400		AOBJN	T2,CRYPT2
02500		HRRZ	T2,0(P)
02600		TLO	T2,(<1B0>)
02700	CRYPT2:	AOBJN	T1,CRYPT1
02800		JRST	CRYPTA
02900	
03000	CRYPT3:	HLR	B,B
03100		AOBJN	B,.+1
03200		SUB	P,B
03300	CRYPT4:	POPJ	P,
     
00100	
00200	CWRAN:	LDB	T4,[POINT 3,C,4]
00300		POP	P,T2
00400	CWRAN0:	XOR	C,[13702,,175435]
00500		TLZ	C,760000
00600		JUMPE	C,CWRAN0
00700		HLRZ	T3,MAJIK(T4)
00800	CWRAN1:	MOVEI	Z,6
00900	CWRAN2:	MOVE	B,C
01000		ROT	B,13
01100		XOR	B,C
01200		ROT	B,-6
01300		LSHC	C,6
01400		SOJG	Z,CWRAN2
01500		PUSH	P,C
01600		SOJG	T3,CWRAN1
01700		MOVE	B,MAJIK(T4)
01800		JRST	0(T2)
01900	
02000	MAJIK:	7,,4
02100		11,,5
02200		12,,7
02300		13,,11
02400		17,,10
02500		17,,13
02600		21,,5
02700		22,,13
02800	
02900		END