G
Great
Unregistered / Unconfirmed
GUEST, unregistred user!
//密钥生成移位表(循环左移)
ShiftTable : array [1..16] of Byte = (1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1);
type
Array28 = array [1..28] of byte;
procedure Shift(var SubKeyPart)
-------->问题?
var
SKP: Array28 absolute SubKeyPart
--------》问题?
n, b: byte;
begin
//把SKP循环左移1次
b := SKP[1];
for n:=1 to 27 do
SKP[n] := SKP[n+1];
SKP[28] := b;
end;
//生成子密钥
procedure SubKey(Round: Byte
var C, D: Array28
var SubKey);
var
SK: array [1..48] of byte absolute SubKey;
n, b: Byte;
begin
//C, D分别循环左移,移动次数取决于密钥生成移位表(ShiftTable)的内容
for n := 1 to ShiftTable[Round] do
begin
Shift(C);
Shift(D);
end;
//利用置换距阵2,生成子密钥
for n := 1 to 48 do
begin
b := PC_2[n];
if b <= 28 then SK[n] := C else SK[n] := D[b-28];
end;
end;
ShiftTable : array [1..16] of Byte = (1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1);
type
Array28 = array [1..28] of byte;
procedure Shift(var SubKeyPart)
-------->问题?
var
SKP: Array28 absolute SubKeyPart
--------》问题?
n, b: byte;
begin
//把SKP循环左移1次
b := SKP[1];
for n:=1 to 27 do
SKP[n] := SKP[n+1];
SKP[28] := b;
end;
//生成子密钥
procedure SubKey(Round: Byte
var C, D: Array28
var SubKey);
var
SK: array [1..48] of byte absolute SubKey;
n, b: Byte;
begin
//C, D分别循环左移,移动次数取决于密钥生成移位表(ShiftTable)的内容
for n := 1 to ShiftTable[Round] do
begin
Shift(C);
Shift(D);
end;
//利用置换距阵2,生成子密钥
for n := 1 to 48 do
begin
b := PC_2[n];
if b <= 28 then SK[n] := C else SK[n] := D[b-28];
end;
end;