php

Secure Hash PHP

Secure Hash

This Is The Most Secure Way To Hash Your Data .
It Is Almost Impossible To Retrieve Your Data .

Create Two Random Keys And Save Them In Your Configuration File


<?php
// Create A Random Key
echo base64_encode(openssl_random_pseudo_bytes(64));
?>


<?php
// Save The Keys In Your Configuration File
define('FIRSTKEY','TNYazlbZ1Mq3HDMiEFDLrRMZBftFqpU2Ipytgytsc+jmQysE8lmigKtmGK+exB337ZOcAgwPpWmoPHL5niO3jA==');
define('SECONDKEY','z5hh/Kax4+HKZ8exOlvGlrHev/6ZynOEn904yiiIcWo/qLXWSfLkzm4NSJiGXu4uR7xxUowOkO26VqAi2p2DYQ==');
?>


<?php
function secured_hash($data)
{
$first_key = base64_decode(FIRSTKEY);
$second_key = base64_decode(SECONDKEY);

$first_hashed = hash_hmac('sha3-512', $data, $first_key, TRUE);
$second_hashed = hash_hmac('sha3-512', $first_hashed, $second_key);

return $second_hashed;
}
?>