I need you to write two pieces of code.
Implement function encrypt($data) in PHP. The function encrypts a given string data and encodes the result to be url safe. A checksum is also added to the result.
Implement Function Decrypt(data : String; var Log : TStringList) : String; in Delphi. The function decrypts given data encrypted by the PHP function code. The Decrypt function also checks the checksum added by encrypt(). If an error occurs, such as the checksums do not match, return an empty string and write an error message to the given Log. The Log is used for debug purposes, so use it to report the process of the Decrypt process.
You can use whatever encryption algorithm and checksum algorithm you want, but the algorithms must be off-the-shelf, i.e. not custom made. The encoding algorithm can be custom made. If you can implement any algorithm, implement AES, Twofish or Blowfish.
For the encryption password, use "Foobar".
Usage example: [url removed, login to view] contains the Encrypt function and it outputs the result to the screen. So a Delphi program with Decrypt function included, can execute [url removed, login to view], get the encrypted data, decrypt it and show it to the user.
Note: Both functions must be unicode safe. I.e. the data can contain unicode characters. The Delphi code must work under Delphi 2010.