ok, so:
AES_ENCRYPT()
Decode()
in mysql, and
mcrypt in PHP
which one is the most secure?
can mcrypt encrypt and decrypt a large text?
thanks again
Main Topics
Browse All TopicsHello,
I have a long text (lowercase char and int, no space) need to be stored in the mysql database: ie:
text:
5cd079ba15e82976bf42f4fdde
d5aba97900c109e1f83edbe8c1
19d049570aef8fa1574803b85b
b2904ac06e16c2157b31e381f6
e8596cc521235de4b4159b243a
cc3add3c17a9a7d79f496dd38c
cdd3dd2220c760a3d7c13a364d
c08a86ba54c074dd18c4570308
92f9fdd90ce22a46989238321e
ea9f59505ce1661788ccdd11bd
e7c7c82df33f4da997bda001e4
77de8ccbc9618e5d86873cc6ba
480aca28fb28f5694514bde4a9
758262dfd3a9c83a920c695c3e
cc3add3c17a9a7d79f496dd38c
cdd3dd2220c760a3d7c13a364d
c08a86ba54c074dd18c4570308
92f9fdd90ce22a46989238321e
ea9f59505ce1661788ccdd11bd
e7c7c82df33f4da997bda001e4
77de8ccbc9618e5d86873cc6ba
480aca28fb28f5694514bde4a9
758262dfd3a9c83a920c695c3e
224881c5b4b13sdds63fc8ca3b
224881c5b4b13sdds63fc8ca3b
72f39aa96d281d9d5dab78fc3f
4b9abf7ea7b6asd39e246509cc
d6c840b0624b7d5313234e12e6
281649e44875ba2e7efef25036
d1b86c8237e039604807159022
019a2e4062d45b822b1435d67a
f48c526fb764e4c22067152951
9506a369f280b89430200580f0
I want to secure the text by using the MySQL encode function:
Encode($longtext, $mykey), however I am not able to retrieve the text using:
Decode($longtext, $mykey), and when I do this, I only retrieve some weird characters.
My Questions are:
1. Why I retrieve some weird text when using Decode()?
2. Besides Encode, what other function can be used to BOTH Encrypt and Decrypt the text?
Thank you
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
which one is the most secure?
To tell you the truth, i have limited knowledge on which one is most secure and cannot help you there.
can mcrypt encrypt and decrypt a large text?
http://us3.php.net/manual/
This webpage has whole lot of information on this part if you are interested.
From link above:
AES_ENCRYPT() and AES_DECRYPT() were added in MySQL 4.0.2, and can be considered the most cryptographically secure encryption functions currently available in MySQL.
Keep in mind that using a MySQL function to encrypt the data means the data is sent in cleartext from your application to the SQL server then encrypted right before it is stored. When unencrypted, it is again sent in clear text to your application. If they are on the same machine this shouldn't be a problem but if the data is coming from a client workstation, it will be sent in cleartext from the client to the webserver then to the sql server, then encrypted. Even if you use the PHP function, it will be sent in cleartext from the client to the webserver.
It really depends on the design of your app and where the data is comming from and where it needs to be encrypted. You could need a combination of SSL, mcrypt and/or aes_enctypt.
Business Accounts
Answer for Membership
by: akshah123Posted on 2005-06-02 at 14:20:11ID: 14134836
1. Why I retrieve some weird text when using Decode()?
ysql/en/en cryption-f unctions.h tml
The reason you can get weird character may be that you are storing them as long text. Store the encoded values as 'BLOB' column instead.
2. Besides Encode, what other function can be used to BOTH Encrypt and Decrypt the text?
Check out: http://dev.mysql.com/doc/m