PHP code example of fruit / cryptokit

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

    

fruit / cryptokit example snippets


$data = 'hello world';
$crypter = new Fruit\CryptoKit\ROT13;

$encrypted = $crypter->encrypt($data);
$data = $crypter->decrypt($encrypted);

stream_filter_register('myfilter', 'Fruit\CryptoKit\CryptoFilter');
$f = fopen('myfile.txt', 'r');
stream_filter_append($f, 'myfilter', STREAM_FILTER_READ, [
	'crypter' => new Fruit\CryptoKit\ROT13,
	'crypt_type' => 'encrypt',
]);
$encrypted = stream_get_contents($f);
fclose($f);

$h = new Fruit\CryptoKit\Hash('md5');
$hashsum = $h->update($data)->sum();

$f = fopen('myfile', 'r');
$h = new Fruit\CryptoKit\Hash('md5');
$hashsum = $h->updateStream($f)->sum();
fclose($f);