Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Password Encryption

by Anonymous Monk
on Aug 21, 2002 at 06:15 UTC ( [id://191662]=note: print w/replies, xml ) Need Help??


in reply to Password Encryption

Thanks to everyone who contributed

A one-way hash is not going to work in our case as the perl script is supposed to run in a non-interactive mode.

The perl script simply reads the properties file, decrypts the password and then logs into the unix machine.

The basic idea was just to slow someone down. I tried using the some of the well known algorthims (such as DES),
but found the ciphertext contained non-alphabetic/non-numeric characters. Does anyone know how I can restrict the output to just these chars ?

I appreciate doing this is going to make the encryption less secure, but that isn't too important.

Replies are listed 'Best First'.
Just store the ciphertext in hex
by audreyt (Hermit) on Aug 21, 2002 at 08:06 UTC
    You really want to use pack/unpack to hex-format your ciphertext, so that they are guaranteed to be alphanumeric.

    To wit:

    use Crypt::CBC; $cipher = Crypt::CBC->new( { key => 'SomeSecretKeyHere', cipher => 'Rijndael', }); my $source_text = "This data is hush hush"; my $cipher_text = unpack('H*', $cipher->encrypt($source_text)); my $decrypted = $cipher->decrypt(pack('H*', $cipher_text));
    Also, please do not use the fragile DES cipher, as weak crypto is worse than no crypto. Rijndael is much more secure, almost as fast, and equally easy to use.

    Thanks,
    /Autrijus/

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://191662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found