can anybody share, the best encryption and decryption technique in PHP.
here i just found 3 ways. are that any better technique?
<?php //1 $password = 'mothafucka'; $sSalt = '8*S&AsEc4qUs'; $sHash = hash( 'whirlpool', $password . $sSalt ); echo $sHash."<br><br>"; //2 $password = "palancau87"; $password = sha1($password); $password = md5($password); echo $password."<br><br>"; //3 function getSalt( $iLength = 10 ) { $sPossible = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()-+=[]{}|'; $iPossibleCount = strlen( $sPossible ); $sSalt = ''; for( $i=0; $i<$iLength; $i++ ) { $sSalt .= $sPossible[mt_rand(0, $iPossibleCount)]; } return $sSalt; } $sSalt = getSalt(); $sHash = hash('whirlpool', $password . $sSalt ); echo $sHash."<br><br>"; ?>
Output:
52fc3756a4248bd5c059174d6d43f3579796ffb7f260451413bdc7ba821e7260f33306aa0973c6c5371632ca097deb93a6e8e54f3eb2e43035f037e74a423bad
20ccad752a137fe77724688ff82a5fd9
418b652b4a858e740202d88483636cdd181e74dc4bc25bab3b887a566e43bf9d542c0c21304b738ddb41a1735d8bdbfbe75156826bfdaa18083047a58e06103f