
March 31st, 2008, 10:25 AM
|
|
|
|
Hcrypt - A simple to use PHP encryption
Ok,
As you see in one of the other threads in this category and it's a sticky I said about encrpyting encrpyted strings for more security but then you could just have a list of them so I have created a simple PHP script for your use that encrypts encypted strings but using diffrent encryption functions eg. MD5, sha1 and crypt and then having your own defined strings that will influence the encryption thus making it extremley difficult or maybe imposible for any decrpytion/cracking.
Here is the script:
PHP Code:
<?
//This is a test HCRYPT script
//Ofcourse HCRYPTing will take a little longer then normal crypting eg. just using md5() function
//This is ofcourse used to stop dictonary attacks
function hcrypt($data)
{
//This is the editable area, I recomend you edit this from the default values
$var1 = "287"; //!WARNING1! THESE MUST BE NUMBERS
$var2 = "215"; //!WARNING1! THESE MUST BE NUMBERS
$var3 = "18"; //!WARNING1! THESE MUST BE NUMBERS
$var4 = "15"; //!WARNING1! THESE MUST BE NUMBERS
//This bit doesn't need editing but you can if you wish
$letters1 = array(
"a",
"d",
"e",
"f",
"g",
"h",
"x",
"y",
"z"
);
$letters2 = array(
"k",
"l",
"m",
"c",
"n",
"o",
"p",
"q",
"r",
"s",
"t"
);
$letters3 = array(
"u",
"v",
"b",
"i",
"j",
"w",
);
$vars = ($var1-$var2)+($var3-$var4);
$thecrypt_hcrypt = sha1(md5($vars.md5($data)));
$thecrypt_hcrypt = str_ireplace($letters1, "861", $thecrypt_hcrypt);
$thecrypt_hcrypt = str_ireplace($letters2, "349", $thecrypt_hcrypt);
$thecrypt_hcrypt = str_ireplace($letters3, "132", $thecrypt_hcrypt);
$final = crypt($thecrypt_hcrypt, "salt");
return $final;
}
?>
Save it as hcrypt.php
Remember to modify the $var1, $var2, $var3 and $var4 strings.
it is easy to use just include the script and then use the function hcrypt()
Example
PHP Code:
<?
include"hcrypt.php";
echo hcrypt("hello, this is a test. Test123 etc.");
?>
|