phpNutt
phpNutt

Reputation: 1539

MYSQL: using des decrypt function with lower

I have encrypted user data in my database using des_encrypt, now when i specify a particular statement as below:

SELECT LOWER( DES_DECRYPT( forename, 'ENCRYPT STRING' ) )
FROM Users

All the results are NOT returned in lowercase, anybody know what i am doing wrong? or perhaps how another way to do it?

p.s ENCRYPT STRING is a random character string, not the actual word. Thanks, Matt

Upvotes: 1

Views: 1220

Answers (1)

Tobias
Tobias

Reputation: 737

You may try this:

SELECT LOWER ( CONVERT ( DES_DECRYPT ( forename, 'ENCRYPT STRING' ) USING utf8 ) )
AS forename_decrypted FROM Users

The Lower-function can only convert strings, I don't know exactly if DES_DECRYPT returns a string or simply binary data..

Upvotes: 2

Related Questions