S- - 8


NEXT j%

NEXT i%

END SUB

18.3

SUB transpose (datax() AS INTEGER, T() AS INTEGER, n%)

letbe XT(), datax(), 64

FOR i% = 1 TO n%

datax(i%) = XT(T(i%))

NEXT i%

END SUB

SUB xtob (a$, mbits() AS INTEGER)

LOCAL X$,NIBBLE$

FOR i% = 1 to 16

X$ = MID$(a$,i%,1)

SELECT CASE X$

CASE "0"

NIBBLE$ = "0000"

CASE "1"

NIBBLE$ = "0001"

CASE "2"

NIBBLE$ = "0010"

CASE "3"

NIBBLE$ = "0011"

CASE "4"

NIBBLE$ = "0100"

CASE "5"

NIBBLE$ = "0101"

CASE "6"

NIBBLE$ = "0110"

CASE "7"

NIBBLE$ = "0111"

CASE "8"

NIBBLE$ = "1000"

CASE "9"

NIBBLE$ = "1001"

CASE "A"

NIBBLE$ = "1010"

CASE "B"

NIBBLE$ = "1011"

CASE "C"

NIBBLE$ = "1100"

CASE "D"

NIBBLE$ = "1101"

CASE "E"

18.3

NIBBLE$ = "1110"

CASE "F"

NIBBLE$ = "1111"

CASE ELSE

Print " 16- !"

SYSTEM

END SELECT

FOR j% = 1 to 4

mbits(((i% - 1) * 4) + j%) = ASC(MID$(NIBBLE$, j%, 1)) - 48

NEXT j%

NEXT i%

END SUB

18.4.

DES Basic

$CPU 80386

$FLOAT NPX

$OPTIMIZE SPEED

$LIB ALL-

$OPTION CNTLBREAK ON

DECLARE FUNCTION MYBIN$ (n%)

DECLARE FUNCTION desalg$ (a$)

DECLARE SUB f (i%, a%(), x%())

DECLARE SUB transpose (datax%(), T%(), n%)

DECLARE SUB mrotate (keyx%())

DECLARE SUB stob (a$, mbits%())

DECLARE SUB btos (mbits%(), a$)

DECLARE SUB letbe (target%(), source%(), last%)

DECLARE SUB init (x() AS INTEGER, n%)

DECLARE SUB sboxinit (b() AS INTEGER)

DECLARE SUB xtob (a$, mbits%())