on 2/28/01 4:18 PM, Kinney Baughman at [EMAIL PROTECTED] wrote:

> Hi,
> 
> I'm trying to encrypt credit_card numbers in MySQL 3.23.33.  I want to
> decrypt them when I retrieve them.
> 
> I've tried:
> 
> mysql> insert into payment (payname1,ccaccount) values
> ("Kinney",encode('5555444433332222','Ilwfci');
> ERROR 1064: You have an error in your SQL syntax near '' at line 1

You just have unbalanced parenthesis. Add another closing paren before the
semi-colon to close the values group and you should be ok. I suspect you
want it quoted as above, but I've never used encode.

> [...]
>
> According to the manual, one should use: DECODE(crypt_str,pass_str) where
> "crypt_str" should be a string returned from ENCODE().  This seems to be a
> catch-22, though.  Wouldn't I have to know the value of "crypt_str", i.e.
> the credit_card number in order to get that encrypted string out of
> ENCODE()?

Again, I've never used it, but...the string returned by encode() would be
the value from your field. Just fetch it, and pass that to decode, along
with the key used to encode it. You'll just need to know what key you used,
not the value.

Geoff


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to