Skip to content

Instantly share code, notes, and snippets.

@iamweird
Created March 3, 2017 11:10
Show Gist options
  • Save iamweird/9e7ccb885ace398ce6f034fdd72612f8 to your computer and use it in GitHub Desktop.
Save iamweird/9e7ccb885ace398ce6f034fdd72612f8 to your computer and use it in GitHub Desktop.
Simple PHP script to generate /etc/shadow style $6$ (SHA-512) password hashes
#!/usr/bin/env php
<?php
if (count($argv) < 3) {
echo <<<USAGE
Usage: genshadow.php salt password
USAGE;
exit(0);
}
$salt = $argv[1];
$password = $argv[2];
echo crypt($password, "\$6\$$salt\$"), "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment