Switch to symfony

This commit is contained in:
R. Eric Wheeler 2017-03-29 08:28:00 -07:00
parent f5fd66706b
commit 65d87cc609
2 changed files with 20 additions and 2 deletions

View File

@ -44,9 +44,8 @@
"phpunit/phpunit": "^6.0",
"silex/providers": "^2.0",
"silex/web-profiler": "^2.0",
"symfony/debug-bundle": "^3.2",
"symfony/debug-bundle": "^3.2",
"symfony/var-dumper": "^3.2"
},
"autoload": {
"psr-4": {

19
hash.php Normal file
View File

@ -0,0 +1,19 @@
<?php
use ParagonIE_Sodium_Compat as SodiumCompat;
require 'vendor/autoload.php';
$randomBytes = substr(
SodiumCompat::randombytes_buf(512),
random_int(SodiumCompat::CRYPTO_GENERICHASH_BYTES, 512),
SodiumCompat::CRYPTO_GENERICHASH_BYTES_MAX
);
$rawToken = SodiumCompat::crypto_generichash(
$randomBytes,
SodiumCompat::randombytes_buf(
SodiumCompat::CRYPTO_GENERICHASH_BYTES_MAX
),
32
);
$token = SodiumCompat::bin2hex($rawToken);
print $token . PHP_EOL;