From: Michael Widenius Date: March 14 1999 2:24pm Subject: Re: Crypt Limitation? List-Archive: http://lists.mysql.com/mysql/259 Message-Id: <14059.50721.706730.173803@monty.pp.sci.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable >>>>> "Paul" =3D=3D Paul DuBois 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") | +----------------------------+ | =9B)=A6 | +----------------------------+ 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