Download ChaCha20 Poly1305 PHP Class
plaintext: Lorem Ipsum is simply dummy text of the printing and typesetting industry... r_key: aed519120bc3427eeb816b080c57eee056a90715 aad: 67ce8acd40af6bfecad8fb4c166ee6f617bbab2f Iv: bf09d526744f355bb237ea08faca85bbd8ba6b32 crypt: cdf652aacbdff5d8110b00282d4acedae6328392e35c88d6ad2456f9be485aa320235cad4c4725e1c77d31e5c45c030f497de7ce483a1ec14d508a384586f5020ebf0c3f4e9d3d555c5f45609ac76c8f40e10d4167499c3adf00ea4b 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