Пример #1
0
#!/usr/bin/php
<?php 
require_once '../Anubis.php';
$src = 'test-file.txt';
$encrypted = 'encrypted.file';
$decrypted = 'test-file-decrypted.txt';
$time = microtime(true);
$cypher = new vtvz\anubis\Anubis();
//never do it if file supposed to be greater than several KB
//$cypher->file_blocksize = filesize($src);
$cypher->setKey("", true);
$cypher->encryptFile($src, $encrypted);
$cypher->decryptFile($encrypted, $decrypted);
$time = microtime(true) - $time;
$src_hash = md5_file($src);
$decrypted_hash = md5_file($decrypted);
echo "Src:  {$src_hash}\n";
echo "Dest: {$decrypted_hash}\n";
echo "Time: {$time} s\n";