Reputation: 1165
i am using ccbill and making upgrade system . In that i need to pass the username or user id plus the key in TripleDES encrypted string, Base64 Encoded format . I know we can use base64_encode
for base64 encoding . But how to achieve the requirements they want the value to be in ?
Upvotes: 0
Views: 683
Reputation: 3005
The first example from the mcrypt page in the PHP documentation has TripleDES for you http://php.net/manual/en/mcrypt.examples.php
<?php
$key = "this is a secret key";
$input = "Let us meet at 9 o'clock at the secret place.";
$td = mcrypt_module_open('tripledes', '', 'ecb', '');
$iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$encrypted_data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$base64encodedafter3des=base64_encode($encrypted_data);
?>
Also looks like someone has answered this question in perfect detail already. Here is a link to his answer. You want the post by @Eric Kigathi about ccbill https://stackoverflow.com/a/11925394/4179009
Upvotes: 1