Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Crypt Function

Status
Not open for further replies.

Extension

Programmer
Nov 3, 2004
311
CA
Hi,

I'm currently encrypting passwords using Perl's Crypt function. (salt)
I can encrypt the password, but now I would to know how to decrypt it.

Code:
$password = "test";
$key1 = "key1";

$encrypt = crypt($password,'$key1');

print $encrypt;



 
You DON'T!
Crypt is one way only.
You can test if you have the right password by encrypting your sample password with the same salt and see if the output is the same.




(very injured) Trojan.
 

Thanks Trojan,

I have more than 400 passwords to decrypt in order to encrypt them with a different key. Is there a way to achieve this with another function (decrypting password) ???

Thank you
 
crypt is a one way only system.
You cannot decrypt anything that was encrypted in it.





(very injured) Trojan.
 
One thing you could do is set the key for each password up using characters that exist in the password. That way, when you decrypt, you could grab those characters again, crypt the user entered password and verify it against the existing crypted password.

Again, not fool-proof, but it's something you could try.

Code:
$password = "testpasswd";
$key1 = substr(3,1) . substr (5,1); #key is 'ts'

$encrypt = crypt($password,'$key1');

print $encrypt;

- Rieekan
 
Hi Extension

Can i ask why you need to decrypt the passwords in order to encrypt them again?


Kind Regards
Duncan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top