Switch to symfony
This commit is contained in:
parent
f5fd66706b
commit
65d87cc609
|
@ -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": {
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue