Storing encrypted passwords in mySQL

Sarah Reichelt sarah.reichelt at gmail.com
Wed Nov 23 00:18:55 CST 2005


On 11/23/05, John Tregea <john at debraneys.com> wrote:
> I am hoping for a suggestion or two on a "simple" way to encrypt a text
> string for storage in mySql. I have built a login dialog (on a card) and
> hide what the user types like this
>

snip
>
> That seems to work fine, but the resulting variable gThePass holds the
> password in plain text. I want to store the password in mySql along with the
> users name and other details.
>
> So my question is;
>
> Is there a way of encrypting the plain text string in Rev, (before sending
> to mySQL) so I can store it in a mySQL table. I don't want the password to
> be human readable by logging into mySQL and doing a SELECT statement
> directly.
>

As Trevor has suggested, you can use the md5digest function to encrypt
your plain text. I sometimes use base64encode for the same sort of
thing. If you want to get a bit more sophisticated, have a look at
Richard Gaskin's pack & unpack routines at revJournal
<http://www.revjournal.com/tutorials/handy-handlers-005.html>

Cheers,
Sarah



More information about the use-livecode mailing list