Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   PHP (https://www.clubdelphi.com/foros/forumdisplay.php?f=15)
-   -   Encriptación (https://www.clubdelphi.com/foros/showthread.php?t=44628)

Novás 11-06-2007 19:22:03

Encriptación
 
Buen día a todo el mundo, veréis mi pregunta es la siguiente:

Tengo un código que uso para encriptar cadenas, pero este código está en Delphi y no controlo mucho como adaptarlo a php. ¿Alguién sería tan amable de traducirmelo a php? Muchas grácias

Código Delphi [-]
function EnDeCrypt(const Value : String) : String;
var
  CharIndex : integer;
begin
  Result := Value;
  for CharIndex := 1 to Length(Value) do
    Result[CharIndex] := chr(not(ord(Value[CharIndex])));
end;

Hagen 12-06-2007 05:24:45

Pues mas o menos asi:


Código PHP:

function EnDeCrypt ($value) {
  
$Result $value;
  for (
$CharIndex=0$CharIndex <= strlen($value) - 1$CharIndex ++) {
    
$Result[$CharIndex] = Chr(not(Ord($value[$CharIndex])));
  }
  return 
$Result;


Espero te sirva...


La franja horaria es GMT +2. Ahora son las 01:14:26.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi