Skip to content

Instantly share code, notes, and snippets.

@aaronhurt
Last active August 29, 2015 13:57
Show Gist options
  • Save aaronhurt/9834877 to your computer and use it in GitHub Desktop.
Save aaronhurt/9834877 to your computer and use it in GitHub Desktop.
<?php
if (php_sapi_name() !== 'cli') {
die('This script may only be run from the command line.' . "\n");
}
if ($argc < 2) {
die('Usage: ' . $argv[0] . ' <encryption key>' . "\n");
}
$key = substr(str_pad($argv[1], 16, "\0"), 0, 16);
$iv = substr(md5($key), 0, 8);
printf("key bin\t== %s\nkey hex\t== %s\n", $key, strtoupper(bin2hex($key)));
printf("iv bin\t== %s\niv hex\t== %s\n", $iv, strtoupper(bin2hex($iv)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment