Created
February 27, 2016 02:17
-
-
Save Darep/cb94500c8fbb70c4a226 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Encrypts a "secrets.json" file using mcrypt | |
* | |
* Usage: php secrets_encrypt.php > secrets.ejson | |
*/ | |
require(dirname(__FILE__) . '/key.php'); | |
function _secrets_encrypt($string) { | |
return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5(SECRET_KEY), $string, MCRYPT_MODE_CBC, md5(md5(SECRET_KEY)))); | |
} | |
$plain_json = file_get_contents(dirname(__FILE__) . '/secrets.json'); | |
if ($plain_json !== FALSE) { | |
echo _secrets_encrypt($plain_json); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment