Pisałem na tym na inny forum lecz nie dostałem odpowiedzi więc postanowiłem tu napisać :)
Czy ktoś wie jak przerobić ten kod:
type
Bytes = array of Byte;
function Encrypt(Buffer, Key, IV: Bytes): Bytes;
var
Encryptor: ICryptoTransform;
ST: MemoryStream;
Encrypt: CryptoStream;
FAlgorythm: RijndaelManaged;
begin
if (IV = '') or (Key = '') then
begin
Result := Buffer;
Exit;
end;
FAlgorythm := RijndaelManaged.Create;
FAlgorythm.IV := IV;
FAlgorythm.Key := Key;
FAlgorythm.Mode := CipherMode.CBC;
FAlgorythm.Padding := PaddingMode.Zeros;
Encryptor := FAlgorythm.CreateEncryptor;
ST := MemoryStream.Create;
Encrypt := CryptoStream.Create(ST, Encryptor, CryptoStreamMode.Write);
Encrypt.Write(Buffer, 0, Length(Buffer));
Encrypt.FlushFinalBlock;
Result := ST.ToArray;
end;
function Decrypt(Buffer, Key, IV: Bytes): Bytes;
var
Decryptor: ICryptoTransform;
ST: MemoryStream;
Decrypt: CryptoStream;
FAlgorythm: RijndaelManaged;
begin
if (IV = '') or (Key = '') then
begin
Result := Buffer;
Exit;
end;
FAlgorythm := RijndaelManaged.Create;
FAlgorythm.IV := IV;
FAlgorythm.Key := Key;
FAlgorythm.Mode := CipherMode.CBC;
FAlgorythm.Padding := PaddingMode.Zeros;
Decryptor := FAlgorythm.CreateDecryptor;
ST := MemoryStream.Create(Buffer);
Decrypt := CryptoStream.Create(ST, Decryptor, CryptoStreamMode.Read);
SetLength(Result, ST.Length);
Decrypt.Read(Result, 0, ST.Length);
end;
tak żeby kodował i rozkodowywał tekst w stringu?? (.net)
Lub jak przerobić TO!!! z C# do delphi.NET