class function TTools.softmac_ansi99(pInitData: pbyte; pInBuf: pbyte;
nInLen: integer; pKey: pbyte; pOutInfo: pbyte): boolean;
var
indata: array [0 .. 33 - 1] of byte;
outdata: array [0 .. 33 - 1] of byte;
nlen, i, j: integer;
sOut: string;
begin
nlen := 0;
i := 0;
j := 0;
fillchar(indata, sizeof(indata), #0);
fillchar(outdata, sizeof(outdata), #0);
if (nInLen mod 8 = 0) then
nlen := nInLen
else
nlen := (floor(nInLen / 8) + 1) * 8;
for i := 0 to 8 - 1 do
begin
indata[i] := pInitData[i] xor pInBuf[i];
end;
for i := 0 to floor(nlen / 8) - 1 - 1 do
begin
fillchar(outdata, sizeof(outdata), #0);
sOut := DESEncrypt_Hex(@indata, 8, pKey, 8, @outdata);
for j := 0 to 8 - 1 do
begin
indata[j] := outdata[j] xor pInBuf[(i + 1) * 8 + j];
end;
end;
sOut := DESEncrypt_Hex(@indata, 8, pKey, 8, @outdata);
copymemory(pOutInfo, @outdata, 8);
result := true;
end;
nInLen: integer; pKey: pbyte; pOutInfo: pbyte): boolean;
var
indata: array [0 .. 33 - 1] of byte;
outdata: array [0 .. 33 - 1] of byte;
nlen, i, j: integer;
sOut: string;
begin
nlen := 0;
i := 0;
j := 0;
fillchar(indata, sizeof(indata), #0);
fillchar(outdata, sizeof(outdata), #0);
if (nInLen mod 8 = 0) then
nlen := nInLen
else
nlen := (floor(nInLen / 8) + 1) * 8;
for i := 0 to 8 - 1 do
begin
indata[i] := pInitData[i] xor pInBuf[i];
end;
for i := 0 to floor(nlen / 8) - 1 - 1 do
begin
fillchar(outdata, sizeof(outdata), #0);
sOut := DESEncrypt_Hex(@indata, 8, pKey, 8, @outdata);
for j := 0 to 8 - 1 do
begin
indata[j] := outdata[j] xor pInBuf[(i + 1) * 8 + j];
end;
end;
sOut := DESEncrypt_Hex(@indata, 8, pKey, 8, @outdata);
copymemory(pOutInfo, @outdata, 8);
result := true;
end;