Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to decrypt sha1 in php?

Tags:

php

sha1

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
like image 865
Mani Kandan Avatar asked May 13 '15 11:05

Mani Kandan


1 Answers

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.

like image 107
Zgr3doo Avatar answered Oct 17 '22 15:10

Zgr3doo