>>>>> "Paul" == Paul DuBois <paul@stripped> writes:
Paul> At 7:39 AM -0600 3/13/1999, Hank Eskin wrote:
>> I've been using the CRYPT function, but it seems I can
>> only encrypt strings of eight characters or less, since longer
>> strings with the same first eight characters
>> will return the same encrypted string even if they are
>> different strings. Is there a way to encrypt longer
>> strings? I've read the docs, and didn't see anything
>> about this limitation.
Paul> I assume you mean ENCRYPT(), not CRYPT().
The newer MySQL versions has actually an internal crypt function that
you can use:
mysql> select encode("hello","password");
+----------------------------+
| encode("hello","password") |
+----------------------------+
| )¦ |
+----------------------------+
1 row in set (0.07 sec)
mysql> select decode(encode("hello","password"),"password");
+-----------------------------------------------+
| decode(encode("hello","password"),"password") |
+-----------------------------------------------+
| hello |
+-----------------------------------------------+
1 row in set (0.00 sec)
Note that you should save the crypted string in a 'BLOB' to get this
to be stored correctly!
Regards,
Monty