3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Some example variables: $alice_ecdh_secret = "Hallo"; $bob_ecdh_public = "Welt"; $message_keypair = sodium_crypto_box_keypair_from_secretkey_and_publickey( $alice_ecdh_secret, $bob_ecdh_public ); $plaintext = "This is a secret message for your eyes only."; $nonce = random_bytes(24); // And now for the actual public-key encryption step: $ciphertext = sodium_crypto_box($plaintext, $nonce, $message_keypair);

preferences:
36.14 ms | 402 KiB | 5 Q