PHP code example of mb-tec / chacha20

1. Go to this page and download the library: Download mb-tec/chacha20 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mb-tec / chacha20 example snippets


$chacha20 = new ChaCha20\Cipher;
$encCtx = $chacha20->init($key, $nonce);
$decCtx = $chacha20->init($key, $nonce);

$cipherText = $chacha20->encrypt($encCtx, $message);
$plainText = $chacha20->decrypt($decCtx, $cipherText);