This is sample PHP code I made to hash a string. Does this method have any extra security benefits or is it not practical at all?
<?php
$string = "Pickles";
$salt_1 = "8w87wv87w43j78wv43jf4wv34zv3wv43twvv";
$salt_2 = "mnd9r4ng8rnf903ng8gm6ks9rhr74ner7fu4";
$salt_3 = "4hr84h4yeu3je8u3ir94j59ti5i59it5j5i9";
$layer_1 = sha1(md5(hash($salt_1.$string.$salt_3)));
$layer_2 = sha1(md5(hash($salt_2.$layer_1.$salt_1)));
$layer_3 = sha1(md5(hash($salt_3.$layer_2.$salt_2)));
$final_result = $layer_3;
echo $final_result;
?>
Any thoughts or suggestions?
MD5 and SHA1 are one way hashes. Is it your intention to decrypt these messages in order to read them later? If not, this is not encryption. It is merely obtaining hash values of a string that has been encrypted with a salt key, three times. Here’s some sound advice on inventing your own encryption algorithm:
http://diovo.com/2009/02/wrote-your-own-encryption-algorithm-duh/
https://security.stackexchange.com/questions/2202/lessons-learned-and-misconceptions-regarding-encryption-and-cryptology
Is this kind of encryption "safe"?