Skip to content

Instantly share code, notes, and snippets.

@petermuller71
petermuller71 / cryptor.php
Last active Apr 4, 2022
cryptor : PHP Encryption and decryption based on libsodium (standard lib >php7.2)
View cryptor.php
<?php
print "<h1>PHP Encryption with libsodium</h1>";
$message = "This text is secret";
$ciphertext = cryptor::encrypt("password", $message);
$plaintext = cryptor::decrypt("password", $ciphertext);
print "Message:<br />$message <br /><br />Ciphertext:<br />$ciphertext<br /><br />Plaintext:<br />$plaintext";