How to decrypt sha1 in php?

Below I have encrypted the varible string with sha1. And now I would like to decrypt the data using the sha1 function, but I am going here and there. Will anyone go ahead and guide me properly, 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 
+6
source share
6 answers

SHA-1 is a one-way hash function.

According to wikipedia

A cryptographic hash function is a hash function that is considered almost impossible to invert, that is, recreate the input from its hash value.

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

Thus, you simply cannot decrypt it.

+22
source


SHA1 cannot be germinated easily.
The only way through it is a brute force cracker.
They are widely available on the Internet, for example: http://md5-sha.com/md5-encrypt-hash-generator-online
These websites have a large database of already hashed passwords, which can be very useful.
Hope this helps, have a good day.

+1
source

SHA-1 cannot be decrypted directly. This is the idea: encryption that cannot be easily decrypted.

The only way to solve this problem is brute force: try to guess the correct result by encoding phrases and checking if they match the provided phrase.

If you want to use SHA-1 for things like logins: also encode the password you entered in SHA-1 and check if it matches the one stored in SHA-1.

0
source

The SHA1 hash cannot be cut, but you can try it online at many different sites that embrace the password database and this is the SHA1 hash. So you can try the online tools:

SHA1 Decoder Online

SHA1 tool

0
source

You cannot decrypt it.

Hashing - One-way - MD5 and SHA-1 are both one-way hash functions.

You need to create a new input hash in the login form and check if it matches the stored hash.

0
source

If you cannot decrypt and want to show the value, use this method.

Example: you create a registration form with an encrypted password and want to show the password to the user after entering your panel.

then create two columns for one column for encrypted_password and one for not_encrypted_password,

 $not_encrypted_password="password"; $encrypted_password =sha1("password"); $sql = mysqli_query($conn,"INSERT INTO user (not_encrypted_password,encrypted_password)VALUES('$not_encrypted_password','$encrypted_password')"); 

this way you can use login for the encrypted_password column and show the password in the control panel for the user to use the not_encrypted_password column.

0
source

Source: https://habr.com/ru/post/987128/


All Articles