1. Go to this page and download the library: Download ialopezg/encryption 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/ */
ialopezg / encryption example snippets
/**
* Creates a random key with the length specified. Optional the result could be returned with capital letters.
*
* @param int $length Output length.
* @param bool $capitalize Whether if the result key will be returned with capital letters.
*
* @throws Exception If it was not possible to gather sufficient entropy.
* @return string A random key.
*/
public static function createKey($length, $capitalize = false): string
/**
* Gets an option value. If value does not exists will return the default value.
*
* @param string $key Option key name.
* @param null $default Option default value.
*
* @return mixed
*/
public function getOption($key, $default = null): string
/**
* Encrypts a simple text password into a ciphered password.
*
* @param string $password Plain text password.
*
* @return string Ciphered password.
* @throws Exception If data provided is not a string.
*/
public function hash($password): string
/**
* Sets an option value.
*
* @param string $key Option key name.
* @param mixed $value Option value.
*
* @return void
*/
public function setOption($key, $value): string
$encrypter = new \ialopezg\Libraries\Encryption\Password();
$encrypter->setOption('key', $key);
/**
* Verifies if a hashed password is equal to the plain tex provided.
*
* @param string $password Plain text password.
* @param string $hash Ciphered text
*
* @return bool true If password equals to hash, false otherwise.
* @throws Exception If data provided is not a string.
*/
public function verify($password, $hash): bool
$encrypter = new \ialopezg\Libraries\Encryption\Password();
$password = 'YOUR_PASSWORD';
$encrypted_password = 'YOUR_ENCRYPTED_PASSWORD';
// Display the encrypted string
echo 'Password are equals: <strong>' . ($encrypter->verify($password, $encrypted_password) ? 'true' : 'false') . '</strong>';
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.