Download ChaCha20 Poly1305 PHP Class
plaintext: Lorem Ipsum is simply dummy text of the printing and typesetting industry... r_key: 51eaa4bbfa84c230d0ec8da16b7e915f4be5a47e aad: d77cac2ad3fd08d052ebf2baf90bb83ee3ec07b6 Iv: 8526eb46717da2fbb3f46b94ae0aa531d9071666 crypt: 97928b1fd273c544b3729f49848aa7243745f5a91b40bdcdc3ada540dcbc59d75ee10ca54db0665173d425cdb16c9e2cbf12729d1e6e778a28fbedf2c48601e18143b1e51829b40847c3478d7404ee555fbd927576e76d81e2447466 decrypt: Lorem Ipsum is simply dummy text of the printing and typesetting industry...
<?php
include("AEAD_CHACHA20_POLY1305.php");
$x = new AEAD_CHACHA20_POLY1305;
$plaintext = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry...';
$r_key = sha1(sha1(sha1(mt_rand(0, 99999) + time())));
$aad = sha1(sha1(sha1(mt_rand(0, 99999) + time())));
$Iv = sha1(sha1(sha1(mt_rand(0, 99999) + time())));
$crypt = $x->chacha20_aead_encrypt($aad, $Key, $Iv, '07000000', $plaintext);
$decrypt = $x->chacha20_aead_decrypt($aad, $Key, $Iv, '07000000', $crypt);
$out = '<pre>';
$out .= "plaintext:\t".$plaintext."\n\n";
$out .= "r_key:\t".$r_key."\n";
$out.= "aad:\t".$aad."\n";
$out .= "Iv:\t".$Iv."\n\n";
$out .= "crypt:\t".$crypt."\n\n";
$out .= "decrypt:\t".$decrypt."\n\n";
$out .= '</pre>';
echo $out;
?>
КОНЬЯКОВ.ру > pubs > phpclasses > chacha20-and-poly130