Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // SALT FUNCTION
- // returns a salted and sha1ed string
- function salt( $string, $salt="lsaklALKJD29+3139+=?=)!?#=)?=!)(_xXx!£¤&/{]s()}=?+\^~*aslskdaXDAO=)" )
- {
- $chars = "abcdefghijklmnopqrstvwxyzABCDEFGHIJKLMNOPQRSTVWXYZ";
- $string .= substr($chars,0,10-strlen($string)); // Adds characters to string to make sure it's not empty
- $salt .= substr($chars,0,10-strlen($salt)); // Same for the salt
- $strlen = strlen($string); // Get string length
- $half = ceil( $strlen / 2 ); // Get half string int
- $smallint = ceil( strlen($salt) % 10 + 1); // Get a small int :)
- // Add some salt for extra taste
- $salted = substr($salt,0,$smallint) . substr($string,0,$half) . substr($salt,$smallint) . substr($string, $half) . substr($salt,-$smallint);
- // Smoke hash
- return sha1($salted);
- }
Add Comment
Please, Sign In to add comment