PHP code example of delboy1978uk / bone-crypt

1. Go to this page and download the library: Download delboy1978uk/bone-crypt 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/ */

    

delboy1978uk / bone-crypt example snippets


composer 

use Bone\Crypt\Crypt;

$crypt = new Crypt();

// returns array with key, IV, tag, and ciphertext
$encrypted = $crypt->encrypt('Super secret data'); 

// Take the key out of the array and json encode
$key = $encrypted['key'];
unset($encrypted['key']);

// this is your payload. Save the key somewhere!
$json = \json_encode($encrypted); 

// To decrypt
$result = $this->crypt->decrypt($json, $key); // 'Super secret data'