Tema: c a delphi7
Ver Mensaje Individual
  #1  
Antiguo 29-11-2022
DarkSton DarkSton is offline
Miembro
 
Registrado: jun 2017
Posts: 64
Reputación: 7
DarkSton Va por buen camino
c a delphi7

hola comunidad encontre este codigo AES
Código PHP:
private static byte[] AesEncryptBlock(byte[] plainTextbyte[] Key)
        {
            
byte[] output_buffer = new byte[plainText.Length];

            
using (AesManaged aesAlg = new AesManaged())
            {
                
aesAlg.Mode CipherMode.ECB;

                
aesAlg.BlockSize 128;
                
aesAlg.KeySize 128;
                
aesAlg.Padding PaddingMode.None;
                
aesAlg.Key Key;

                
// Create a encryptor to perform the stream transform.
                
ICryptoTransform encryptor aesAlg.CreateEncryptor(aesAlg.KeyaesAlg.IV);
                
encryptor.TransformBlock(plainText0plainText.Lengthoutput_buffer0);
            }

            return 
output_buffer;
        }

        
// not used, but nice to have around
        
private static byte[] AesDecryptBlock(byte[] cipherTextbyte[] Key)
        {
            
byte[] output_buffer = new byte[cipherText.Length];

            
using (AesManaged aesAlg = new AesManaged())
            {
                
aesAlg.Mode CipherMode.ECB;

                
aesAlg.BlockSize 128;
                
aesAlg.KeySize 128;
                
aesAlg.Padding PaddingMode.None;
                
aesAlg.Key Key;

                
// Create a decryptor to perform the stream transform.
                
ICryptoTransform decryptor aesAlg.CreateDecryptor(aesAlg.KeyaesAlg.IV);
                
decryptor.TransformBlock(cipherText0cipherText.Lengthoutput_buffer0);
            }
            return 
output_buffer;
        }

        static 
string GLParameters(string usernamestring password)
        {
            
// final block (unknown) looks like 4 DWORDs, first one being always zero, second always nonzero, third and fourth are occasionally zero
            
List<byteresult = new List<byte>();
            
byte[] key = { 0xFA0xEE0x850xF20x400x730xD90x160x130x900x190x7F0x6E0x560x2A0x67 };
            
byte[] finalBlock = { 000000000000000};
            
result.AddRange(AesEncryptBlock(StringToBytes(username16), key));
            
result.AddRange(AesEncryptBlock(StringToBytes(password16), key));
            
result.AddRange(AesEncryptBlock(finalBlockkey));
            return 
BitConverter.ToString(result.ToArray()).Replace("-""").ToUpper();
        } 
como puedo pasarlo a delphi7
Responder Con Cita