December 28, 2018

Your second implementation

$nonce = random_bytes(SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);

Should work if you have the extension installed and properly configured. I would look into that if I were you.

You can check your PHP’s configuration using phpinfo() to check if the sodium is enabled.

And, If you haven’t installed, install using:

sudo pecl install -f libsodium

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!