Методы и средства защиты информации



              

Механизм действия S-блоков - часть 9


DIM s(1 TO 8, 1 TO 64) AS shared INTEGER

' Инициализация

RESTORE InitialTrl

Продолжение листинга 18.4

DIM InitialTr(1 TO 64) AS shared INTEGER

init InitialTr(), 64

RESTORE FinalTrl

DIM FinalTr(1 TO 64) AS shared INTEGER

init FinalTr(), 64

RESTORE swappyl

DIM swappy(1 TO 64) AS shared INTEGER

init swappy(), 64

RESTORE KeyTr1l

DIM KeyTr1(1 TO 56) AS shared INTEGER

init KeyTr1(), 56

RESTORE KeyTr2l

DIM KeyTr2(1 TO 48) AS shared INTEGER

init KeyTr2(), 48

RESTORE etrl

DIM etr(1 TO 48) AS shared INTEGER

init etr(), 48

RESTORE ptrl

DIM ptr(1 TO 32) AS shared INTEGER

init ptr(), 32

sboxinit s()

RESTORE rotsl

DIM rots(1 TO 16) AS shared INTEGER

init rots(), 16

DIM XR(1 TO 56) AS shared INTEGER

DIM EF(1 TO 64) AS shared INTEGER

DIM ikeyf(1 TO 64) AS shared INTEGER

DIM yf(1 TO 64) AS shared INTEGER

DIM ades(1 TO 64) AS shared INTEGER

DIM bdes(1 TO 64) AS shared INTEGER

Продолжение листинга 18.4

DIM xdes(1 TO 64) AS shared INTEGER

DIM XT(1 TO 64)   AS shared INTEGER

DIM P2(1 TO 64) AS shared INTEGER

main:

CLS

parm$ = ltrim$(rtrim$(COMMAND$))+" "

IF LEN(parm$) > 1 THEN

 

cipherf$ = LTRIM$(RTRIM$(LEFT$(parm$, INSTR(parm$, " "))))

 

PRINT "Имя  зашифрованного файла : "; cipherf$

ELSE

 

INPUT "Имя расшифрованного файла : ", cipherf$

END IF

if len(cipherf$)=0 then

 

print : print "СБОЙ: введите имя файла!"

 

system

end if

OPEN cipherf$ FOR RANDOM AS 1

lof1& = LOF(1)

IF lof1& = 0 THEN

 

CLOSE #1

 

KILL cipherf$

 

PRINT : PRINT "Файл не найден!";

 

SYSTEM

ELSE

 

CLOSE #1

 

OPEN cipherf$ for binary access read as #1

END IF

PW$ = ""

LOCATE 6, 1

INPUT "                    Пароль : ", PW$

IF (LEN(PW$) < 8) THEN PW$ = PW$ + STRING$(8 - LEN(PW$), 0)

IF len(pw$) = 16 then

  

LOCATE 6, 1: PRINT "                    Пароль : ";

  

STRING$(16, 15); STRING$(10, " ")

Продолжение листинга 18.4

    PW$ = ucase$(PW$)       



Содержание  Назад  Вперед