Switch to symfony
This commit is contained in:
parent
f5fd66706b
commit
65d87cc609
|
@ -46,7 +46,6 @@
|
|||
"silex/web-profiler": "^2.0",
|
||||
"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