Skip to content

Instantly share code, notes, and snippets.

@soatok
Created October 5, 2017 06:06
Show Gist options
  • Save soatok/282f0fcea5c3e5940349b5ededb9e702 to your computer and use it in GitHub Desktop.
Save soatok/282f0fcea5c3e5940349b5ededb9e702 to your computer and use it in GitHub Desktop.
<?php
declare(strict_types=1);
$password = 'OwO what\'s this?';
$alg = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT;
$opslimit = SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE;
$memlimit = SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE;
$salt = 'YIFFYIFFYIFFYIFF';
$secret_key = sodium_crypto_pwhash(32, $password, $salt, $opslimit, $memlimit, $alg);
$ciphertext = base64_decode("azSM4RHZt2mUQK/7erNxIrUsBLn5em6cK1gelBV9W9TKRqwZdETlNFiuDhzK6cI00S05LmhpCQyoqIZF9EErIHVnsP5na/Fr");
$nonce = 'YIFFYIFFYIFFYIFFYIFFYIFF';
$plaintext = sodium_crypto_secretbox_open($ciphertext, $nonce, $secret_key);
echo $plaintext, PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment