Google
 

Trailing-Edge - PDP-10 Archives - BB-F493Z-DD_1986 - 10,7/endecr.mac
There are 9 other files named endecr.mac in the archive. Click here to see a list.
TITLE	ENDECR - ALC STYLE ENCRIPTION SCHEME


	SEARCH	UUOSYM

.BCOPY
COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986. ALL RIGHTS RESERVED.
.ECOPY
\;END COPYRIGHT MACRO


;COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986. ALL RIGHTS RESERVED.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR ANY  OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF THE  SOFTWARE  IS  HEREBY
;TRANSFERRED.
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT  NOTICE
;AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY  OF  ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
	TWOSEG

COMMENT	$

	THE FOLLOWING CODE CONSISTS OF 3 BASIC ROUTINES:
1) CRASZ. - WARMUP ROUTINE FOR ASCIZ SEED
2) CRSIX. - WARMUP ROUTINE FOR A SIXBIT ATOM
3) CRYPT. - BASIC CRYPTION

CALLING CONVENTIONS:
	THESE 3 SUBROUTINES USE AC'S 0-7, ARGUMENTS ARE PASSED
IN 5 , 6 , AND 7  - ANSWERS RETURNED IN 5.

1)	MOVE	A,<ADDR OF ASCIZ STRING OR BP>
	PUSHJ	P,CRASZ.
	......		;SEED RETURNED IN (C)

2)	MOVE	C,<SIXBIT ATOM>
	PUSHJ	P,CRSIX.
	......		;SEED RETURNED IN (C)

3)	MOVE	A,<AOBJN WORD TO BLOCK TO BE CRYPTED>
	MOVE	B,<BLOCK KEY (BLOCK NUMBER WILL DO)>
	MOVE	C,<SEED GENERATED BY CRASZ. OR CRSIX.>
	PUSHJ	P,CRYPT.
	......		;ALWAYS RETURN
$
	ENTRY	CRASZ.,CRSIX.,CRYPT.

;AC DEF'S

Z==0
T1==1
T2==2
T3==3
T4==4
C==5
B==6
A==7
P==17
;CRASZ. - CONVERTS ASCIZ STRINGS POINTED TO BY (A) INTO SEEDS

	RELOC 400000

CRASZ.:	TLNN	A,-1		;SEE IF BYTE-PNTR
	HRLI	A,(<POINT 7,,>)
	MOVEI	B,0
	PUSH	P,B
CRASZ1:	MOVEI	C,0
	MOVE	T1,[POINT 6,C]
CRASZ2:	ILDB	Z,A
	JUMPE	Z,CRASZ3
	CAIG	Z,"Z"+40
	CAIG	Z," "
	JRST	CRASZ2
	CAILE	Z,"_"
	SUBI	Z,40
	SUBI	Z,40
	IDPB	Z,T1
	TLNE	T1,770000
	JRST	CRASZ2
	XOR	C,0(P)
	PUSHJ	P,CRSIX.
	MOVEM	C,0(P)
	JRST	CRASZ1

CRASZ3:	JUMPE	C,CRASZ4
	XOR	C,0(P)
	PUSHJ	P,CRSIX.
	MOVEM	C,0(P)
CRASZ4:	POP	P,C
	JUMPN	C,CRASZ5
	SKIPE	B
	MOVE	C,[13702,,175435]
CRASZ5:	POPJ	P,

;CRSIZ. - HANDLES SIXBIT ATOMS (CALLED FROM CRASZ.)

CRSIX.:	JUMPE	C,CRSIX1
	PUSHJ	P,CWRAN
	HLR	B,B
	SUB	P,B
CRSIX1:	POPJ	P,
;CRYPT. - BASIC BLOCK EN/DE CRYPTER

CRYPT.:	JUMPE	C,CRYPT4
	MOVE	Z,B
	IMULI	Z,200401
	AND	Z,[11111111]
	MUL	Z,[11111111]
	TLZ	T1,(<6B2>)
	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