1. So you are sending the password in plain text over the network each time you connect to the db? Apparently, you don't trust your system (otherwise, you wouldn't use the rather pointless "encrypt the password, but have the decryption key on file" technique), so why would you trust your network?
  2. Two things here. First you let your users send their passwords in plain text over the internet. Which already means that there isn't much security. Second, storing the passwords such that they can easily be decrypted is insecure, and not needed. Standard technique is to encrypt the password using a one-way technique (like crypt) and store the encrypted password. When a password comes in, encrypt it, and compare the encrypted passwords.
  3. Digest::MD5 isn't a suitable encryption technique, as this merely creates a hash. It's a one-way function, and you can't go back and retrieve the unencrypted text. To determine what the most suitable technique is, you have to state why you want to encrypt. What do you want to hide against whom? How much time can you spend encrypting/decrypting? How much resources is an attacker willing to employ? Note that security is as weak as its weakest link. There isn't much point in running a "secure OS" which is as hardened as it can be, and using 4096 bit keys if the data you want to protect comes in plain text over the internet, from a virus infected PC.

In reply to Re: What *are* the best ways to encrypt data? by Anonymous Monk
in thread What *are* the best ways to encrypt data? by bradcathey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.