![]() |
Delphi PHP und Blowfish
Hallo,
ich muss etwas in Delphi verschlüsseln und mit PHP wieder entschlüsseln. Hierfür nutze ich DEC 5.2, allerdings peile ich das nicht so recht. Vielleicht könnte mir jemand auf die Schnelle sagen warum folgendes nicht läuft? Das wäre super ... vielen Dank. Ich möchte einfach nur "quick and dirty" etwas auf die Schnelle halbwegs (!) sicher verschlüsseln.
Code:
function encryptBlowfisch(Key, Source: string): String;
var IV: string; begin IV := '12345678'; with DECCipher.TCipher_Blowfish.Create do try Mode := cmCBCx; Init(Key,IV); Result := EncodeBinary(Source, TFormat_HEX); finally Free; end; end; function decryptBlowfisch(Key, Source: string): String; var IV: string; begin IV := '12345678'; with DECCipher.TCipher_Blowfish.Create do try Mode := cmCBCx; Init(Key,IV); Result := DecodeBinary(Source, TFormat_HEX); finally Free; end; end;
Code:
$decrypted_data = mcrypt_cfb (MCRYPT_BLOWFISH, $key, $input, MCRYPT_ENCRYPT, '12345678');
|
AW: Delphi PHP und Blowfish
Was geht nicht?
Kommt ein Fehler? Kommt was falsches raus? |
AW: Delphi PHP und Blowfish
Wenn ich das Ergebnis von "decryptBlowfisch" der PHP als $Input gebe, kommt alles raus, aber nicht das richtige.
|
AW: Delphi PHP und Blowfish
Häh?
|
AW: Delphi PHP und Blowfish
Also, bei Delphi kommt folgendes raus:
Code:
Unter PHP
encryptBlowfisch('schluessel','Hallo Welt');
// Ergibt 4AB79BC001D8CA706467
Code:
$key = 'schluessel';
$input = '4AB79BC001D8CA706467'; $decrypted_data = mcrypt_cfb (MCRYPT_BLOWFISH, $key, $input, MCRYPT_DECRYPT, '12345678'); // Ergibt zNZqXeQEH4s+lXFX6F6buKINKKI=, aber nicht "Hallo Welt" |
AW: Delphi PHP und Blowfish
Wahrscheinlich verwendet DEC einen andere initialization vector
|
AW: Delphi PHP und Blowfish
Wird der nicht so übergeben?
Code:
IV := '12345678';
Init(Key,IV); |
AW: Delphi PHP und Blowfish
In DEC verwendest Du Cipher Block Chaining (CBC), in PHP Cipher Feedback (CFB). Verwende doch mal den gleichen Modus ;)
|
AW: Delphi PHP und Blowfish
DecodeBinary ... Unicode?
Was kommt bei MCRYPT_DECRYPT im PHP raus? PS: ![]() |
AW: Delphi PHP und Blowfish
Ruft intern "Encode" auf. Ich kann doch nix anderes aufrufen.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 19:35 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz