Skip to content
Advertisement

How to decrypt sha1 in php?

Below i had encrypted a string varible using sha1. And now i would wish to decrypt data using sha1 function, but am going some where. Would some one come forward and guide me in proper way please.

Below is my code

<?php
   $variable  = "tiger";
   echo $variable;
   $encrypt = sha1($variable);
   echo $encrypt;
   $decrypt = sha1($encrypt);
   echo $decrypt;
 ?>

And i get output like this

tiger
46e3d772a1888eadff26c7ada47fd7502d796e07
989df2c8b5ea37eb7cfde0527d94c01a15257002

Advertisement

Answer

SHA-1 is an one-way hash function.

According to wikipedia

A cryptographic hash function is a hash function which is considered practically impossible to invert, that is, to recreate the input data from its hash value alone.

http://en.wikipedia.org/wiki/Cryptographic_hash_function

Thus you simply can not decrypt it.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement