Skip to content

Instantly share code, notes, and snippets.

@jordic
Last active November 4, 2015 13:26
Show Gist options
  • Save jordic/331c68915b41e931824e to your computer and use it in GitHub Desktop.
Save jordic/331c68915b41e931824e to your computer and use it in GitHub Desktop.
3DES_crypt
<?php
#$key = 'sq7HjrUOBfKmC576ILgskD5srU870gJ7';
#$order = '12345';
$key = $argv[1];
$order = $argv[2];
$bytes = array(0,0,0,0,0,0,0,0);
$iv = implode(array_map("chr", $bytes));
$ct = mcrypt_encrypt(MCRYPT_3DES, base64_decode($key), $order, MCRYPT_MODE_CBC, $iv);
#echo $ct . '\n';
echo "Base 64 encoded key:\n";
echo base64_encode($ct);
echo "\n";
FROM php:5.6-cli
RUN apt-get update && apt-get install -y libmcrypt-dev \
&& docker-php-ext-install mcrypt
CMD ["php"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment