1

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

phpNutt
  • 1,529
  • 7
  • 23
  • 40
  • 1
    the LOWER( 'StRiNg' ) function in MySQL turns the string in its argument to lowercase. Or what exactly do you mean? – Tobias Mar 09 '10 at 14:42
  • I mean that in my database there are forenames that are multiple case, (i.e upper and lower) and i want the string to be returned as lowercase. – phpNutt Mar 09 '10 at 14:49

1 Answers1

2

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

Tobias
  • 737
  • 1
  • 9
  • 20