ReCryptor can quickly and safely change your encryption algorithm.
ReCryptor is good for you if you use an outdated encryption algorithm and you need to change to a new one without a system failure and so users do not know anything.
The recommended way to install is via Composer:
composer require filipsedivy/recryptor
It needed a minimum version of PHP 5.6.
<?php
require_once __DIR__ . '/vendor/autoload.php';
$recryptor = new ReCryptor();
$recryptor->setInput('MyPassword');
$recryptor->setHash('daa1f31819ed4928fd00e986e6bda6dab6b177dcbool');
$result = $recryptor->recrypt('SHA1');
if($result->needRehash())
{
// Need save new hash
$hash = $result->getHash();
}
else
{
// Not need change hash
}
<?php
require_once __DIR__.'/vendor/autoload.php';
$recryptor = new ReCryptor();
print_r($recryptor->getAlgorithms());
It is also possible to use hash classes. Using them, you can encrypt the input or have the hash validated. Each class inherits the object ReCryptor\Abstraction\Algorithm
.
<?php
require_once __DIR__.'/vendor/autoload.php';
use ReCryptor\Algorithm\SHA512;
$sha512 = new SHA512();
$sha512->setInput('Hello world');
echo $sha512->hash();
<?php
require_once __DIR__.'/vendor/autoload.php'
use ReCryptor\Algorithm\SHA512;
$sha512 = new SHA512();
$sha512->setInput('Hello world');
$sha512->setHash('098f6bcd4621d373cade4e832627b4f6');
var_dump($sha512->isAlgorithm());
PayPal: mail@filipsedivy.cz