Python kodu.
Kod: Tümünü seç
obj = Cipher(algorithms.AES(xored_key), modes.ECB(),
backend=default_backend()).encryptor()
return obj.update(plaintext) + obj.finalize()
Key ve data şu şekilde. (Hex olarak)
Key : '000102030405060708090a0b0c0d0e0f'
Data : '783490fd6a6c90f07236a8ed402794f8732c96fb711fa0f46c349ac4792493e8'
Python hesaplaması ve online hesapladığımda sonuç doğru çıkıyor.
Site : http://extranet.cryptomathic.com/aescal ... 927243ED7B
Python sonucu : 'e6861877db7b021e8b755f927243ed7b'
Benim delphide kullandığım kaynak ise şu şekilde.
http://www.delphican.com/attachment.php?aid=225
Kod: Tümünü seç
function HexToStr(HexStr : String; const Text : boolean = True) : String;
var
Hex : byte;
sTemp : string;
i : integer;
begin
Result := '';
if Length(HexStr) mod 2 <> 0 then
Exit;
for i := 2 to Length(HexStr) do
if i mod 2 = 0 then begin
sTemp := '$' + Copy(HexStr, i - 1, 2);
Hex := Byte(StrToInt(sTemp));
if Hex = $00 then begin
if Text then
Result := Result + ''
else
Result := Result + #$00;
Continue;
end;
Result := Result + chr(Hex);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
SifrelenmisVeri:string;
begin
SifrelenmisVeri := EncryptStringHex(hextostr('000102030405060708090a0b0c0d0e0f'),Hextostr('783490fd6a6c90f07236a8ed402794f8732c96fb711fa0f46c349ac4792493e8'));
memo1.Lines.Add(SifrelenmisVeri);
end;
Bu kodun sonucu ise.
'0F000000400E19FF18CAB920206762265B1C11E52019'
bu çıkıyor. ne yaptıysam bir türlü doğru hesaplama yaptıramadım. Yardımlarınız için şimdiden teşekkür ederim.