Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #3  
Antiguo 13-06-2024
marco3k marco3k is offline
Miembro
 
Registrado: feb 2015
Posts: 106
Poder: 12
marco3k Va por buen camino
Bueno gogleando un poco en www hay convertidores de código y encontré este:
https://www.codeconvert.ai/csharp-to-pascal-converter


y el resultado es este:



Código Delphi [-]
uses
  System.SysUtils,
  System.Classes,
  System.Crypto,
  System.Convert;

function Encrypt(clearText: string): string;
var
  EncryptionKey: string;
  clearBytes: TBytes;
  encryptor: TAesManaged;
  pdb: TRfc2898DeriveBytes;
  ms: TMemoryStream;
  cs: TCryptoStream;
begin
  EncryptionKey := 'MAKV2SPBNI99212';
  clearBytes := TEncoding.Unicode.GetBytes(clearText);
  encryptor := TAesManaged.Create;
  try
    pdb := TRfc2898DeriveBytes.Create(EncryptionKey, [0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76]);
    encryptor.Key := pdb.GetBytes(32);
    encryptor.IV := pdb.GetBytes(16);
    ms := TMemoryStream.Create;
    try
      cs := TCryptoStream.Create(ms, encryptor.CreateEncryptor, CryptoStreamMode.Write);
      try
        cs.Write(clearBytes, 0, Length(clearBytes));
      finally
        cs.Free;
      end;
      clearText := TBase64Encoding.UTF8.EncodeToString(ms.ToArray);
    finally
      ms.Free;
    end;
  finally
    encryptor.Free;
  end;
  Result := clearText;
end;

function Decrypt(cipherText: string): string;
var
  EncryptionKey: string;
  cipherBytes: TBytes;
  encryptor: TAesManaged;
  pdb: TRfc2898DeriveBytes;
  ms: TMemoryStream;
  cs: TCryptoStream;
begin
  EncryptionKey := 'MAKV2SPBNI99212';
  cipherBytes := TBase64Encoding.UTF8.DecodeToBytes(cipherText);
  encryptor := TAesManaged.Create;
  try
    pdb := TRfc2898DeriveBytes.Create(EncryptionKey, [0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76]);
    encryptor.Key := pdb.GetBytes(32);
    encryptor.IV := pdb.GetBytes(16);
    ms := TMemoryStream.Create;
    try
      cs := TCryptoStream.Create(ms, encryptor.CreateDecryptor, CryptoStreamMode.Write);
      try
        cs.Write(cipherBytes, 0, Length(cipherBytes));
      finally
        cs.Free;
      end;
      cipherText := TEncoding.Unicode.GetString(ms.ToArray);
    finally
      ms.Free;
    end;
  finally
    encryptor.Free;
  end;
  Result := cipherText;
end.


Tendrias que probarlo...
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema con encriptación php <-> Delphi Reasen Delphi para la web 6 29-12-2015 18:10:47
Encriptación con AES en Delphi 7 nlsgarcia Varios 3 01-09-2011 07:36:20
Encriptacion MD5+RSA en delphi jourdan OOP 9 24-03-2010 01:01:08
Traducir llamado a funcion juanelo C++ Builder 9 28-01-2010 21:11:11
Traducir Un chat que está en Inglés Luis F. Orjuela Internet 2 26-02-2004 01:55:03


La franja horaria es GMT +2. Ahora son las 08:13:21.


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