Курсовая работа: Защита информации от несанкционированного доступа
CodingTools;
function coding_GOST(Buf: Pointer; Size: LongWord; Param: TCodingParameters):Integer;
function coding_GOSTSE(Buf: Pointer; Size: LongWord; Param: TCodingParameters):Integer;
implementation
var
Key: array [0..7] of LongWord;
const
ExchTable: array [0..7,0..15] of byte =
((2,5,3,7,12,1,15,14,9,4,6,8,10,0,11,13),
(8,3,1,9,10,15,2,14,13,5,11,7,0,12,4,3),
(15,1,14,2,13,3,12,4,11,5,10,0,6,9,7,8),
(1,3,5,7,9,2,4,6,8,10,11,13,15,12,14,0),
(1,4,7,10,13,2,5,8,11,0,14,3,6,9,12,15),
(1,5,9,13,2,6,10,0,14,3,7,11,15,4,8,12),
(1,6,11,2,7,12,0,3,8,13,4,9,14,5,10,15),
(1,7,0,13,2,8,14,3,9,15,4,10,5,11,6,12));
C1 = $1010101;
C2 = $1010104;
procedure BaseStep(var N:word64; X: longword);
var
i:integer;
s:word64;
begin
s.v32[0]:=(N.v32[0] + X) mod $100000000;
fori:=0 to 3 do
begin
//Замена по таблице младшие или старшие 4 бита
s.v8[i]:=(ExchTable[i*2,(s.v8[i] and $0F)]) or (ExchTable[i*2+1,((s.v8[i] shr 4) and $0F)] shl 4);
end;