5,388
社区成员
发帖
与我相关
我的任务
分享
var str : string[8];
for i := 1 to 8 do
begin
if (Str1[i]>='0') and (Str1[i]<='9') then
a:=Ord(Str1[i])-ord('0')
else if (Str1[i]>='a') and (Str1[i]<='f') then
a:=Ord(Str1[i])-ord('a')+10
else if (Str1[i]>='A') and (Str1[i]<='F') then
a:=Ord(Str1[i])-ord('A')+10;
if (Str2[i]>='0') and (Str2[i]<='9') then
b:=Ord(Str2[i])-ord('0')
else if (Str2[i]>='a') and (Str2[i]<='f') then
b:=Ord(Str2[i])-ord('a')+10
else if (Str2[i]>='A') and (Str2[i]<='F') then
b:=Ord(Str2[i])-ord('A')+10;
a:=a xor b;
if a>9 then
Str[i] := Chr(Ord('0')+a)
else
Str[i] := Chr(Ord('A')+a-10);
end;
function strxorstr(str1,str2:string):string;
var
i,a,b:integer;
begin
result:='';
for i:=1 to 4 do
begin
a:=strtoint('$'+copy(str1,2*i-1,2));
b:=strtoint('$'+copy(str2,2*i-1,2));
result:=result+inttohex(a xor b,2);
end;
end;