List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 14 1999 2:24pm
Subject:Re: Crypt Limitation?
View as plain text  
>>>>> "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
Thread
Crypt Limitation?Hank Eskin13 Mar
  • Re: Crypt Limitation?Paul DuBois13 Mar
    • Re: Crypt Limitation?Michael Widenius15 Mar
  • No Reply from your side!! Waiting for your reply!!!Murugavel6 Mar
  • Re: No Reply from your side!! Waiting for your reply!!!gerald_clark6 Mar