Traducir de Delphi a Visual Basic
Publicado por asta (3 intervenciones) el 05/06/2006 15:38:09
Buenas, pues necesito traducir este pequeño codigo de delphi a visual basic, y ya que no conozco este primer lenguage, les pido su ayuda. He aqui el código.
const
DELTA = $9e3779b9;
N = 32;
procedure XTeaCrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := 0;
for I := 0 to N - 1 do begin
Inc(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
Inc(S, DELTA);
Inc(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
end;
end;
procedure XTeaDecrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := DELTA * Int64(N);
for I := 0 to N - 1 do begin
Dec(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
Dec(S, DELTA);
Dec(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
end;
end;
Se trata de un sistema de encriptacion. Me ayudaria mucho tenerlo en VB, o al menos que me digan donde me podria orientar para traducirlo por mi mismo. Gracias.
const
DELTA = $9e3779b9;
N = 32;
procedure XTeaCrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := 0;
for I := 0 to N - 1 do begin
Inc(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
Inc(S, DELTA);
Inc(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
end;
end;
procedure XTeaDecrypt(var V: TTeaMsgBlock; const K: TTeaKeyBlock);
var
I: LongWord;
S: Int64;
begin
S := DELTA * Int64(N);
for I := 0 to N - 1 do begin
Dec(V[1], (V[0] shl 4 xor V[0] shr 5) + (V[0] xor S) + K[S shr 11 and 3]);
Dec(S, DELTA);
Dec(V[0], (V[1] shl 4 xor V[1] shr 5) + (V[1] xor S) + K[S and 3]);
end;
end;
Se trata de un sistema de encriptacion. Me ayudaria mucho tenerlo en VB, o al menos que me digan donde me podria orientar para traducirlo por mi mismo. Gracias.
Valora esta pregunta


0