Michael,

I just did something like this, and used the ENCODE/DECODE. Works well.
Basically you want to assign a "special key" for the encoding/decoding of the
data you want to encode/decode. The column type should be either a BLOB or
TINYBOLD, as it's stored in a binary format, depend on the size of the data
being encoded.

To encode the data, you do something like this.
The $key would equal a special value to encode then decode it back, without the
$key, it will not be able to decode the encoded data. Like a password to
encode/decode.

INSERT INTO table_name VALUE
('foo','bar','foobar',ENCODE("$data_to_encode","$key"),'other_data');

Then to retrieve the encoded data,

SELECT DECODE(col_name_with_encode_data,"$key") FROM table_name WHERE something
= 'A_Value';

This is a very simplistic example, but should give you some ideas on how it can
work.

Hope this helps,



>>On Tue, 14 Aug 2001 11:29:07 -0700, "Michael Tam" <[EMAIL PROTECTED]>   wrote:

>>Hi all,
>>
>>    I am very new to the encrypt and decrypt data process and would like to know how 
>do I able to encrypt a string and store to MySQL and retrieve the data and decrypt it 
>at the later time.
>>
>>    I understood it sorts of contradict the point of security but I just want to use 
>it to cover the data such that the non-technical user can see the data is there but 
>they couldn't understand them by just reading it.
>>
>>    It may be a dump question but I would be greatly appreciated for any suggestion 
>or help.


Mike(mickalo)Blezien
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Thunder Rain Internet Publishing
Providing Internet Solutions that work!
http://www.thunder-rain.com
Tel: 1(225)686-2002
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


---------------------------------------------------------------------
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