Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

big important text encryption with MD5 or something else?

by Alex the Serb (Monk)
on Jan 17, 2002 at 15:51 UTC ( #139481=perlquestion: print w/replies, xml ) Need Help??

Alex the Serb has asked for the wisdom of the Perl Monks concerning the following question:

hi,

i have great problem. How could I use Perl module MD5 to encrypt some big text files and than store them in database for later retrival. The most important thing is, how could I decrypt it and display on screen for reading?

These are some very important documents. I already read a lot of stuff here that explain how to crypt using MD5 and compare to see if it was altered or not, but that is not the point! Is there any way to decrypt it using secret that was used to crypt it? Like that someone who stored document using his secret will be able to read it using the same secret.

These documents are stored in database without encryption and anyone with access to server could read it!

thanks,
Alex
  • Comment on big important text encryption with MD5 or something else?

Replies are listed 'Best First'.
Re: big important text encryption with MD5 or something else?
by arhuman (Vicar) on Jan 17, 2002 at 15:55 UTC
    Short answer : You can't !

    MD5 stands for Message Digest 5
    It's a one way fonction which computes a text's digest.
    You can't decrypt a MD5 digest.
    You usually use it to check that the digest of the value just entered is equal to the digest stored.
    (usually passwd management works this way)

    Use other usual encryption schemes if you want to decrypt text.
    (RIJNDAEL, RSA, ELGAMAL...)

    UPDATE :
    I warmly recommend btrott's impressive work (Crypt::OpenPGP)
    which handles several schemes
    (IDEA, DES3, Blowfish, Rijndael, Rijndael192, Rijndael256, Twofish,DSA, RSA, and ElGamal)

    "Only Bad Coders Code Badly In Perl" (OBC2BIP)
Re: big important text encryption with MD5 or something else?
by little (Curate) on Jan 17, 2002 at 16:03 UTC
    MD5 is ireversible. means you cant decrypt, as its only used to encrypt a string to hide it from anyones eyes, eg. entries in a passwd file.
    But you might want to look at CPAN to find a module that fits most your needs. Crypt::Blowfish is quite common in use. Or even use perlmonks search function for "crypt".

    Have a nice day
    All decision is left to your taste
Re: big important text encryption with MD5 or something else?
by IlyaM (Parson) on Jan 17, 2002 at 20:15 UTC
    These documents are stored in database without encryption and anyone with access to server could read it!

    I don't know what degree of access have those guys you don't want to access your data. But you should understand that if they can gain access to your secret keys than they can gain access to your documents anyway. Probably I'm making possibly wrong assumption that your code which decrypts documents will run on same server. If it is so then I'll ask just a couple of questions. Where are your secret keys going to be stored? On same server? If it is going to be entered each time documents are being decrypted will those bad guys be able to modify your scripts to steal your secret keys?

    --
    Ilya Martynov (http://martynov.org/)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://139481]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2020-07-02 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?