This program won't work as mcrypt isn't installed. This is probably a good thing. However here's what was here before we upgraded to php 7.4:

MCRYPT : OPENSSL. Conversion for SagePay Form OSCommerce

Encrypting VendorTxCode=TxCode-1310917599-223087284&Amount=36.95&Currency=GBP&Description=description&CustomerName=Fname Surname&CustomerEMail=customer@example.com&BillingSurname=Surname&BillingFirstnames=Fname&BillingAddress1=BillAddressLine 1&BillingCity=BillCity&BillingPostCode=W1A 1BL&BillingCountry=GB&BillingPhone=447933000000&DeliveryFirstnames=Fname&DeliverySurname=Surname&DeliveryAddress1=BillAddressLine 1&DeliveryCity=BillCity&DeliveryPostCode=W1A 1BL&DeliveryCountry=GB&DeliveryPhone=447933000000&SuccessURL=https://example.com/success&FailureURL=https://example.com/failure

with key 55a51621a6648525

Answer From SagePay example

Which doesn't actually tally with the actual result produced by MCRYPT (which works so I think the documentation in Sage must be wrong). Check out the endings.

The following is using the functions and modifications to the string as per the original sage_pay_form.php file.

Using MCRYPT

$mc = '@' . strtoupper(bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $paddedString, MCRYPT_MODE_CBC, $key)));

Using OPENSSL

$os = '@' . strtoupper( bin2hex( openssl_encrypt ( $paddedString, "aes-128-cbc", $key, OPENSSL_NO_PADDING | OPENSSL_RAW_DATA, $key ) ) );

Same as MCRYPT

MCRYPT Decode

$decode = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $os, MCRYPT_MODE_CBC, $key);

OPENSSL Decode

openssl_decrypt ( $os, "aes-128-cbc", $key , OPENSSL_NO_PADDING | OPENSSL_RAW_DATA, $key );

Same as MCRYPT

Decrypting actual SagePay Return

@2c93c195fdc4793f51a8bd79f551f4c9a70f36e60735f1aef680ec6922774bdb49ff49d6adf36990f7e729b632595b70a6f68c34203205802ece2ee9b021dedf6b48b3bc109af60f9cbf881e327ef85a2bada024bcb5d970683aec6cd5772225de50a6687762a9d94f8b74130d76983c78c26565ef9fcad917c187c5566eb21a6ca88d9780ae8c26f13c4433c43da95652e1f6a799f1e710209dd6686b9adbe237a6bb816d93c536eefe6bbf66a5da0525fc6c8a5f26538857b309dddcd2ff1bda0b6ef68f0ed7045349989ecf252cbfe48e76980ebe5fb6b8661202e37e4eda6ebf504cb662291a5ba0a59907960d80a5648964dd8c62cc157df9738c8ab5e5d0cb3763649aaf21efabd2be2e0409b8

MCRYPT Decode

$decode = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $osc, MCRYPT_MODE_CBC, $key);

OPENSSL Decode

$decode = openssl_decrypt ( $osc, "aes-128-cbc", $key , OPENSSL_NO_PADDING | OPENSSL_RAW_DATA, $key );

Same as MCRYPT