Professional Web Applications Themes

DES acting strange - MySQL

I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt' I can't seem to encrypt the number 227968199 because I tried several times and also tried other numbers which work fine. Here is a sample session: mysql> create table `destest` (num varchar(17)); Query OK, 0 rows affected (0.04 sec) mysql> desc destest; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | num | varchar(17) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 1 row in set (0.00 sec) mysql> insert into destest(num) values(DES_ENCRYPT('227968199', 'sfG3853ncr1pt')); Query OK, 1 row affected (0.00 sec) mysql> select ...

  1. #1

    Default DES acting strange

    I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    I can't seem to encrypt the number 227968199 because I tried several
    times and also tried other numbers which work fine.

    Here is a sample session:

    mysql> create table `destest` (num varchar(17));
    Query OK, 0 rows affected (0.04 sec)

    mysql> desc destest;
    +-------+-------------+------+-----+---------+-------+
    | Field | Type | Null | Key | Default | Extra |
    +-------+-------------+------+-----+---------+-------+
    | num | varchar(17) | YES | | NULL | |
    +-------+-------------+------+-----+---------+-------+
    1 row in set (0.00 sec)

    mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    'sfG3853ncr1pt'));
    Query OK, 1 row affected (0.00 sec)

    mysql> select * from destest;
    +------------------+
    | num |
    +------------------+
    | Ԩ!?`f4~k |
    +------------------+
    1 row in set (0.00 sec)

    mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    +-----------------------------------+
    | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    +-----------------------------------+
    | Ԩ!?`f4~k |
    +-----------------------------------+
    1 row in set (0.00 sec)

    mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    'sfG3853ncr1pt'));
    Query OK, 1 row affected (0.00 sec)

    mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;

    +-----------------------------------+
    | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    +-----------------------------------+
    | Ԩ!?`f4~k |
    | 12345678 |
    +-----------------------------------+
    2 rows in set (0.00 sec)

    soup_or_power@yahoo.com Guest

  2. #2

    Default Re: DES acting strange

    I have also tried

    FLUSH DES_KEY_FILE;

    It is so weird!

    soup_or_power@yahoo.com Guest

  3. #3

    Default Re: DES acting strange

    [email]soup_or_power[/email] wrote:
    > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > I can't seem to encrypt the number 227968199 because I tried several
    > times and also tried other numbers which work fine.
    >
    > Here is a sample session:
    >
    > mysql> create table `destest` (num varchar(17));
    > Query OK, 0 rows affected (0.04 sec)
    >
    > mysql> desc destest;
    > +-------+-------------+------+-----+---------+-------+
    > | Field | Type | Null | Key | Default | Extra |
    > +-------+-------------+------+-----+---------+-------+
    > | num | varchar(17) | YES | | NULL | |
    > +-------+-------------+------+-----+---------+-------+
    > 1 row in set (0.00 sec)
    >
    > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > 'sfG3853ncr1pt'));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select * from destest;
    > +------------------+
    > | num |
    > +------------------+
    > | Ԩ!?`f4~k |
    > +------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | Ԩ!?`f4~k |
    > +-----------------------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > 'sfG3853ncr1pt'));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | Ԩ!?`f4~k |
    > | 12345678 |
    > +-----------------------------------+
    > 2 rows in set (0.00 sec)
    >
    I do not have problems with it

    -- 8< --

    mysql> INSERT INTO destest(num)
    values(DES_ENCRYPT('227968199','sfG3853ncr1pt'));
    Query OK, 1 row affected (0.00 sec)

    mysql> select * from destest;
    +----------------------------+
    | num |
    +----------------------------+
    | Ԩ!?`f4~k |
    +----------------------------+
    1 row in set (0.00 sec)

    mysql> SELECT DES_DECRYPT(num, 'sfG3853ncr1pt') FROM destest;
    +-----------------------------------+
    | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    +-----------------------------------+
    | 227968199 |
    +-----------------------------------+
    1 row in set (0.00 sec)

    mysql> SELECT VERSION();
    +------------+
    | VERSION() |
    +------------+
    | 5.0.16-log |
    +------------+

    -- 8< --

    Wich version are you using?

    This might be the reason:
    [url]http://bugs.mysql.com/bug.php?id=15495[/url]


    Kai

    --
    This signature is left as an exercise for the reader.
    Kai Ruhnau Guest

  4. #4

    Default Re: DES acting strange


    Kai Ruhnau wrote:
    > [email]soup_or_power[/email] wrote:
    > > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > > I can't seem to encrypt the number 227968199 because I tried several
    > > times and also tried other numbers which work fine.
    > >
    > > Here is a sample session:
    > >
    > > mysql> create table `destest` (num varchar(17));
    > > Query OK, 0 rows affected (0.04 sec)
    > >
    > > mysql> desc destest;
    > > +-------+-------------+------+-----+---------+-------+
    > > | Field | Type | Null | Key | Default | Extra |
    > > +-------+-------------+------+-----+---------+-------+
    > > | num | varchar(17) | YES | | NULL | |
    > > +-------+-------------+------+-----+---------+-------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > > 'sfG3853ncr1pt'));
    > > Query OK, 1 row affected (0.00 sec)
    > >
    > > mysql> select * from destest;
    > > +------------------+
    > > | num |
    > > +------------------+
    > > | Ԩ!?`f4~k |
    > > +------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > +-----------------------------------+
    > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > +-----------------------------------+
    > > | Ԩ!?`f4~k |
    > > +-----------------------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > > 'sfG3853ncr1pt'));
    > > Query OK, 1 row affected (0.00 sec)
    > >
    > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >
    > > +-----------------------------------+
    > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > +-----------------------------------+
    > > | Ԩ!?`f4~k |
    > > | 12345678 |
    > > +-----------------------------------+
    > > 2 rows in set (0.00 sec)
    > >
    >
    > I do not have problems with it
    >
    > -- 8< --
    >
    > mysql> INSERT INTO destest(num)
    > values(DES_ENCRYPT('227968199','sfG3853ncr1pt'));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select * from destest;
    > +----------------------------+
    > | num |
    > +----------------------------+
    > | Ԩ!?`f4~k |
    > +----------------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> SELECT DES_DECRYPT(num, 'sfG3853ncr1pt') FROM destest;
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | 227968199 |
    > +-----------------------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> SELECT VERSION();
    > +------------+
    > | VERSION() |
    > +------------+
    > | 5.0.16-log |
    > +------------+
    >
    > -- 8< --
    >
    > Wich version are you using?
    >
    > This might be the reason:
    > [url]http://bugs.mysql.com/bug.php?id=15495[/url]
    >
    >
    > Kai
    Hi Kai
    I'm using 5.0.2-alpha-log mysql. The bug seems to be the case with
    older versions.

    Thanks

    soup_or_power@yahoo.com Guest

  5. #5

    Default Re: DES acting strange

    I restarted mysqld without any luck. Can someone tell me how DES works?
    May be there are some configuration files that can be modified.

    [email]soup_or_power[/email] wrote:
    > Kai Ruhnau wrote:
    > > [email]soup_or_power[/email] wrote:
    > > > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > > > I can't seem to encrypt the number 227968199 because I tried several
    > > > times and also tried other numbers which work fine.
    > > >
    > > > Here is a sample session:
    > > >
    > > > mysql> create table `destest` (num varchar(17));
    > > > Query OK, 0 rows affected (0.04 sec)
    > > >
    > > > mysql> desc destest;
    > > > +-------+-------------+------+-----+---------+-------+
    > > > | Field | Type | Null | Key | Default | Extra |
    > > > +-------+-------------+------+-----+---------+-------+
    > > > | num | varchar(17) | YES | | NULL | |
    > > > +-------+-------------+------+-----+---------+-------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > > > 'sfG3853ncr1pt'));
    > > > Query OK, 1 row affected (0.00 sec)
    > > >
    > > > mysql> select * from destest;
    > > > +------------------+
    > > > | num |
    > > > +------------------+
    > > > | Ԩ!?`f4~k |
    > > > +------------------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > > +-----------------------------------+
    > > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > > +-----------------------------------+
    > > > | Ԩ!?`f4~k |
    > > > +-----------------------------------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > > > 'sfG3853ncr1pt'));
    > > > Query OK, 1 row affected (0.00 sec)
    > > >
    > > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > >
    > > > +-----------------------------------+
    > > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > > +-----------------------------------+
    > > > | Ԩ!?`f4~k |
    > > > | 12345678 |
    > > > +-----------------------------------+
    > > > 2 rows in set (0.00 sec)
    > > >
    > >
    > > I do not have problems with it
    > >
    > > -- 8< --
    > >
    > > mysql> INSERT INTO destest(num)
    > > values(DES_ENCRYPT('227968199','sfG3853ncr1pt'));
    > > Query OK, 1 row affected (0.00 sec)
    > >
    > > mysql> select * from destest;
    > > +----------------------------+
    > > | num |
    > > +----------------------------+
    > > | Ԩ!?`f4~k |
    > > +----------------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> SELECT DES_DECRYPT(num, 'sfG3853ncr1pt') FROM destest;
    > > +-----------------------------------+
    > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > +-----------------------------------+
    > > | 227968199 |
    > > +-----------------------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> SELECT VERSION();
    > > +------------+
    > > | VERSION() |
    > > +------------+
    > > | 5.0.16-log |
    > > +------------+
    > >
    > > -- 8< --
    > >
    > > Wich version are you using?
    > >
    > > This might be the reason:
    > > [url]http://bugs.mysql.com/bug.php?id=15495[/url]
    > >
    > >
    > > Kai
    >
    > Hi Kai
    > I'm using 5.0.2-alpha-log mysql. The bug seems to be the case with
    > older versions.
    >
    > Thanks
    soup_or_power@yahoo.com Guest

  6. #6

    Default Re: DES acting strange

    [email]soup_or_power[/email] wrote:
    > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > I can't seem to encrypt the number 227968199 because I tried several
    > times and also tried other numbers which work fine.
    >
    > Here is a sample session:
    >
    > mysql> create table `destest` (num varchar(17));
    > Query OK, 0 rows affected (0.04 sec)
    >
    > mysql> desc destest;
    > +-------+-------------+------+-----+---------+-------+
    > | Field | Type | Null | Key | Default | Extra |
    > +-------+-------------+------+-----+---------+-------+
    > | num | varchar(17) | YES | | NULL | |
    > +-------+-------------+------+-----+---------+-------+
    > 1 row in set (0.00 sec)
    >
    > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > 'sfG3853ncr1pt'));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select * from destest;
    > +------------------+
    > | num |
    > +------------------+
    > | Ԩ!?`f4~k |
    > +------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | Ԩ!?`f4~k |
    > +-----------------------------------+
    > 1 row in set (0.00 sec)
    >
    > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > 'sfG3853ncr1pt'));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | Ԩ!?`f4~k |
    > | 12345678 |
    > +-----------------------------------+
    > 2 rows in set (0.00 sec)
    >
    Used a char field in a varchar field.


    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

  7. #7

    Default Re: DES acting strange


    Jerry Stuckle wrote:
    > [email]soup_or_power[/email] wrote:
    > > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > > I can't seem to encrypt the number 227968199 because I tried several
    > > times and also tried other numbers which work fine.
    > >
    > > Here is a sample session:
    > >
    > > mysql> create table `destest` (num varchar(17));
    > > Query OK, 0 rows affected (0.04 sec)
    > >
    > > mysql> desc destest;
    > > +-------+-------------+------+-----+---------+-------+
    > > | Field | Type | Null | Key | Default | Extra |
    > > +-------+-------------+------+-----+---------+-------+
    > > | num | varchar(17) | YES | | NULL | |
    > > +-------+-------------+------+-----+---------+-------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > > 'sfG3853ncr1pt'));
    > > Query OK, 1 row affected (0.00 sec)
    > >
    > > mysql> select * from destest;
    > > +------------------+
    > > | num |
    > > +------------------+
    > > | Ԩ!?`f4~k |
    > > +------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > +-----------------------------------+
    > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > +-----------------------------------+
    > > | Ԩ!?`f4~k |
    > > +-----------------------------------+
    > > 1 row in set (0.00 sec)
    > >
    > > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > > 'sfG3853ncr1pt'));
    > > Query OK, 1 row affected (0.00 sec)
    > >
    > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >
    > > +-----------------------------------+
    > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > +-----------------------------------+
    > > | Ԩ!?`f4~k |
    > > | 12345678 |
    > > +-----------------------------------+
    > > 2 rows in set (0.00 sec)
    > >
    >
    > Used a char field in a varchar field.
    Using char instead of varchar will add NULL padding (C like strings).
    But the problem remains unsolved

    mysql> create table `destest3` (num char(17));
    Query OK, 0 rows affected (0.00 sec)
    mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    'sfG3853ncr1pt '));
    Query OK, 1 row affected (0.00 sec)

    mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;

    +-----------------------------------+
    | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    +-----------------------------------+
    | Ԩ!?`f4~k |
    +-----------------------------------+
    1 row in set (0.00 sec)

    soup_or_power@yahoo.com Guest

  8. #8

    Default Re: DES acting strange

    Used binary in the place of varchar to store the DES encrypted string
    in the table without any luck.
    [email]soup_or_power[/email] wrote:
    > Jerry Stuckle wrote:
    > > [email]soup_or_power[/email] wrote:
    > > > I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > > > I can't seem to encrypt the number 227968199 because I tried several
    > > > times and also tried other numbers which work fine.
    > > >
    > > > Here is a sample session:
    > > >
    > > > mysql> create table `destest` (num varchar(17));
    > > > Query OK, 0 rows affected (0.04 sec)
    > > >
    > > > mysql> desc destest;
    > > > +-------+-------------+------+-----+---------+-------+
    > > > | Field | Type | Null | Key | Default | Extra |
    > > > +-------+-------------+------+-----+---------+-------+
    > > > | num | varchar(17) | YES | | NULL | |
    > > > +-------+-------------+------+-----+---------+-------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > > > 'sfG3853ncr1pt'));
    > > > Query OK, 1 row affected (0.00 sec)
    > > >
    > > > mysql> select * from destest;
    > > > +------------------+
    > > > | num |
    > > > +------------------+
    > > > | Ԩ!?`f4~k |
    > > > +------------------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > > +-----------------------------------+
    > > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > > +-----------------------------------+
    > > > | Ԩ!?`f4~k |
    > > > +-----------------------------------+
    > > > 1 row in set (0.00 sec)
    > > >
    > > > mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > > > 'sfG3853ncr1pt'));
    > > > Query OK, 1 row affected (0.00 sec)
    > > >
    > > > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > > >
    > > > +-----------------------------------+
    > > > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > > > +-----------------------------------+
    > > > | Ԩ!?`f4~k |
    > > > | 12345678 |
    > > > +-----------------------------------+
    > > > 2 rows in set (0.00 sec)
    > > >
    > >
    > > Used a char field in a varchar field.
    >
    > Using char instead of varchar will add NULL padding (C like strings).
    > But the problem remains unsolved
    >
    > mysql> create table `destest3` (num char(17));
    > Query OK, 0 rows affected (0.00 sec)
    > mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    > 'sfG3853ncr1pt '));
    > Query OK, 1 row affected (0.00 sec)
    >
    > mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    >
    > +-----------------------------------+
    > | DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > +-----------------------------------+
    > | Ԩ!?`f4~k |
    > +-----------------------------------+
    > 1 row in set (0.00 sec)
    soup_or_power@yahoo.com Guest

  9. #9

    Default Re: DES acting strange

    [email]soup_or_power[/email] wrote:
    > Used binary in the place of varchar to store the DES encrypted string
    > in the table without any luck.
    > [email]soup_or_power[/email] wrote:
    >
    >>Jerry Stuckle wrote:
    >>
    >>>soup_or_power wrote:
    >>>
    >>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    >>>>I can't seem to encrypt the number 227968199 because I tried several
    >>>>times and also tried other numbers which work fine.
    >>>>
    >>>>Here is a sample session:
    >>>>
    >>>>mysql> create table `destest` (num varchar(17));
    >>>>Query OK, 0 rows affected (0.04 sec)
    >>>>
    >>>>mysql> desc destest;
    >>>>+-------+-------------+------+-----+---------+-------+
    >>>>| Field | Type | Null | Key | Default | Extra |
    >>>>+-------+-------------+------+-----+---------+-------+
    >>>>| num | varchar(17) | YES | | NULL | |
    >>>>+-------+-------------+------+-----+---------+-------+
    >>>>1 row in set (0.00 sec)
    >>>>
    >>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    >>>>'sfG3853ncr1pt'));
    >>>>Query OK, 1 row affected (0.00 sec)
    >>>>
    >>>>mysql> select * from destest;
    >>>>+------------------+
    >>>>| num |
    >>>>+------------------+
    >>>>| Ԩ!?`f4~k |
    >>>>+------------------+
    >>>>1 row in set (0.00 sec)
    >>>>
    >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>+-----------------------------------+
    >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>+-----------------------------------+
    >>>>| Ԩ!?`f4~k |
    >>>>+-----------------------------------+
    >>>>1 row in set (0.00 sec)
    >>>>
    >>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    >>>>'sfG3853ncr1pt'));
    >>>>Query OK, 1 row affected (0.00 sec)
    >>>>
    >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>
    >>>>+-----------------------------------+
    >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>+-----------------------------------+
    >>>>| Ԩ!?`f4~k |
    >>>>| 12345678 |
    >>>>+-----------------------------------+
    >>>>2 rows in set (0.00 sec)
    >>>>
    >>>
    >>>Used a char field in a varchar field.
    >>
    >>Using char instead of varchar will add NULL padding (C like strings).
    >>But the problem remains unsolved
    >>
    >> mysql> create table `destest3` (num char(17));
    >>Query OK, 0 rows affected (0.00 sec)
    >>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    >>'sfG3853ncr1pt '));
    >>Query OK, 1 row affected (0.00 sec)
    >>
    >>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    >>
    >>+-----------------------------------+
    >>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>+-----------------------------------+
    >>| Ԩ!?`f4~k |
    >>+-----------------------------------+
    >>1 row in set (0.00 sec)
    >
    >
    I don't have a system with DES available to me at the time. However,
    have you also checked the version of OpenSSL you're using? MySQL uses
    it to do the actual encryption and decryption.

    And the reason I suggested a CHAR field is because I did have problems
    with VARCHAR when using DES. I suspect something was prematurely
    detecting EOF.


    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

  10. #10

    Default Re: DES acting strange


    Jerry Stuckle wrote:
    > [email]soup_or_power[/email] wrote:
    > > Used binary in the place of varchar to store the DES encrypted string
    > > in the table without any luck.
    > > [email]soup_or_power[/email] wrote:
    > >
    > >>Jerry Stuckle wrote:
    > >>
    > >>>soup_or_power wrote:
    > >>>
    > >>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > >>>>I can't seem to encrypt the number 227968199 because I tried several
    > >>>>times and also tried other numbers which work fine.
    > >>>>
    > >>>>Here is a sample session:
    > >>>>
    > >>>>mysql> create table `destest` (num varchar(17));
    > >>>>Query OK, 0 rows affected (0.04 sec)
    > >>>>
    > >>>>mysql> desc destest;
    > >>>>+-------+-------------+------+-----+---------+-------+
    > >>>>| Field | Type | Null | Key | Default | Extra |
    > >>>>+-------+-------------+------+-----+---------+-------+
    > >>>>| num | varchar(17) | YES | | NULL | |
    > >>>>+-------+-------------+------+-----+---------+-------+
    > >>>>1 row in set (0.00 sec)
    > >>>>
    > >>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > >>>>'sfG3853ncr1pt'));
    > >>>>Query OK, 1 row affected (0.00 sec)
    > >>>>
    > >>>>mysql> select * from destest;
    > >>>>+------------------+
    > >>>>| num |
    > >>>>+------------------+
    > >>>>| Ԩ!?`f4~k |
    > >>>>+------------------+
    > >>>>1 row in set (0.00 sec)
    > >>>>
    > >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>+-----------------------------------+
    > >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>+-----------------------------------+
    > >>>>| Ԩ!?`f4~k |
    > >>>>+-----------------------------------+
    > >>>>1 row in set (0.00 sec)
    > >>>>
    > >>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > >>>>'sfG3853ncr1pt'));
    > >>>>Query OK, 1 row affected (0.00 sec)
    > >>>>
    > >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>
    > >>>>+-----------------------------------+
    > >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>+-----------------------------------+
    > >>>>| Ԩ!?`f4~k |
    > >>>>| 12345678 |
    > >>>>+-----------------------------------+
    > >>>>2 rows in set (0.00 sec)
    > >>>>
    > >>>
    > >>>Used a char field in a varchar field.
    > >>
    > >>Using char instead of varchar will add NULL padding (C like strings).
    > >>But the problem remains unsolved
    > >>
    > >> mysql> create table `destest3` (num char(17));
    > >>Query OK, 0 rows affected (0.00 sec)
    > >>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    > >>'sfG3853ncr1pt '));
    > >>Query OK, 1 row affected (0.00 sec)
    > >>
    > >>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    > >>
    > >>+-----------------------------------+
    > >>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>+-----------------------------------+
    > >>| Ԩ!?`f4~k |
    > >>+-----------------------------------+
    > >>1 row in set (0.00 sec)
    > >
    > >
    >
    > I don't have a system with DES available to me at the time. However,
    > have you also checked the version of OpenSSL you're using? MySQL uses
    > it to do the actual encryption and decryption.
    How can I check the version of OpenSSL?
    >
    > And the reason I suggested a CHAR field is because I did have problems
    > with VARCHAR when using DES. I suspect something was prematurely
    > detecting EOF.
    >
    >
    > --
    > ==================
    > Remove the "x" from my email address
    > Jerry Stuckle
    > JDS Computer Training Corp.
    > [email]jstucklexattglobal.net[/email]
    > ==================
    Thanks

    soup_or_power@yahoo.com Guest

  11. #11

    Default Re: DES acting strange

    [email]soup_or_power[/email] wrote:
    > Jerry Stuckle wrote:
    >
    >>soup_or_power wrote:
    >>
    >>>Used binary in the place of varchar to store the DES encrypted string
    >>>in the table without any luck.
    >>>soup_or_power wrote:
    >>>
    >>>
    >>>>Jerry Stuckle wrote:
    >>>>
    >>>>
    >>>>>soup_or_power wrote:
    >>>>>
    >>>>>
    >>>>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    >>>>>>I can't seem to encrypt the number 227968199 because I tried several
    >>>>>>times and also tried other numbers which work fine.
    >>>>>>
    >>>>>>Here is a sample session:
    >>>>>>
    >>>>>>mysql> create table `destest` (num varchar(17));
    >>>>>>Query OK, 0 rows affected (0.04 sec)
    >>>>>>
    >>>>>>mysql> desc destest;
    >>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>| Field | Type | Null | Key | Default | Extra |
    >>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>| num | varchar(17) | YES | | NULL | |
    >>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>1 row in set (0.00 sec)
    >>>>>>
    >>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    >>>>>>'sfG3853ncr1pt'));
    >>>>>>Query OK, 1 row affected (0.00 sec)
    >>>>>>
    >>>>>>mysql> select * from destest;
    >>>>>>+------------------+
    >>>>>>| num |
    >>>>>>+------------------+
    >>>>>>| Ԩ!?`f4~k |
    >>>>>>+------------------+
    >>>>>>1 row in set (0.00 sec)
    >>>>>>
    >>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>>>+-----------------------------------+
    >>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>>>+-----------------------------------+
    >>>>>>| Ԩ!?`f4~k |
    >>>>>>+-----------------------------------+
    >>>>>>1 row in set (0.00 sec)
    >>>>>>
    >>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    >>>>>>'sfG3853ncr1pt'));
    >>>>>>Query OK, 1 row affected (0.00 sec)
    >>>>>>
    >>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>>>
    >>>>>>+-----------------------------------+
    >>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>>>+-----------------------------------+
    >>>>>>| Ԩ!?`f4~k |
    >>>>>>| 12345678 |
    >>>>>>+-----------------------------------+
    >>>>>>2 rows in set (0.00 sec)
    >>>>>>
    >>>>>
    >>>>>Used a char field in a varchar field.
    >>>>
    >>>>Using char instead of varchar will add NULL padding (C like strings).
    >>>>But the problem remains unsolved
    >>>>
    >>>>mysql> create table `destest3` (num char(17));
    >>>>Query OK, 0 rows affected (0.00 sec)
    >>>>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    >>>>'sfG3853ncr1pt '));
    >>>>Query OK, 1 row affected (0.00 sec)
    >>>>
    >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    >>>>
    >>>>+-----------------------------------+
    >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>+-----------------------------------+
    >>>>| Ԩ!?`f4~k |
    >>>>+-----------------------------------+
    >>>>1 row in set (0.00 sec)
    >>>
    >>>
    >>I don't have a system with DES available to me at the time. However,
    >>have you also checked the version of OpenSSL you're using? MySQL uses
    >>it to do the actual encryption and decryption.
    >
    >
    > How can I check the version of OpenSSL?
    >
    From a command line enter

    openssl version


    >
    >>And the reason I suggested a CHAR field is because I did have problems
    >>with VARCHAR when using DES. I suspect something was prematurely
    >>detecting EOF.
    >>
    >>
    >>--
    >>==================
    >>Remove the "x" from my email address
    >>Jerry Stuckle
    >>JDS Computer Training Corp.
    >>jstucklexattglobal.net
    >>==================
    >
    >
    > Thanks
    >

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

  12. #12

    Default Re: DES acting strange


    Jerry Stuckle wrote:
    > [email]soup_or_power[/email] wrote:
    > > Jerry Stuckle wrote:
    > >
    > >>soup_or_power wrote:
    > >>
    > >>>Used binary in the place of varchar to store the DES encrypted string
    > >>>in the table without any luck.
    > >>>soup_or_power wrote:
    > >>>
    > >>>
    > >>>>Jerry Stuckle wrote:
    > >>>>
    > >>>>
    > >>>>>soup_or_power wrote:
    > >>>>>
    > >>>>>
    > >>>>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > >>>>>>I can't seem to encrypt the number 227968199 because I tried several
    > >>>>>>times and also tried other numbers which work fine.
    > >>>>>>
    > >>>>>>Here is a sample session:
    > >>>>>>
    > >>>>>>mysql> create table `destest` (num varchar(17));
    > >>>>>>Query OK, 0 rows affected (0.04 sec)
    > >>>>>>
    > >>>>>>mysql> desc destest;
    > >>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>| Field | Type | Null | Key | Default | Extra |
    > >>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>| num | varchar(17) | YES | | NULL | |
    > >>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>1 row in set (0.00 sec)
    > >>>>>>
    > >>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > >>>>>>'sfG3853ncr1pt'));
    > >>>>>>Query OK, 1 row affected (0.00 sec)
    > >>>>>>
    > >>>>>>mysql> select * from destest;
    > >>>>>>+------------------+
    > >>>>>>| num |
    > >>>>>>+------------------+
    > >>>>>>| Ԩ!?`f4~k |
    > >>>>>>+------------------+
    > >>>>>>1 row in set (0.00 sec)
    > >>>>>>
    > >>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>>>+-----------------------------------+
    > >>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>>>+-----------------------------------+
    > >>>>>>| Ԩ!?`f4~k |
    > >>>>>>+-----------------------------------+
    > >>>>>>1 row in set (0.00 sec)
    > >>>>>>
    > >>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > >>>>>>'sfG3853ncr1pt'));
    > >>>>>>Query OK, 1 row affected (0.00 sec)
    > >>>>>>
    > >>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>>>
    > >>>>>>+-----------------------------------+
    > >>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>>>+-----------------------------------+
    > >>>>>>| Ԩ!?`f4~k |
    > >>>>>>| 12345678 |
    > >>>>>>+-----------------------------------+
    > >>>>>>2 rows in set (0.00 sec)
    > >>>>>>
    > >>>>>
    > >>>>>Used a char field in a varchar field.
    > >>>>
    > >>>>Using char instead of varchar will add NULL padding (C like strings).
    > >>>>But the problem remains unsolved
    > >>>>
    > >>>>mysql> create table `destest3` (num char(17));
    > >>>>Query OK, 0 rows affected (0.00 sec)
    > >>>>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    > >>>>'sfG3853ncr1pt '));
    > >>>>Query OK, 1 row affected (0.00 sec)
    > >>>>
    > >>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    > >>>>
    > >>>>+-----------------------------------+
    > >>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>+-----------------------------------+
    > >>>>| Ԩ!?`f4~k |
    > >>>>+-----------------------------------+
    > >>>>1 row in set (0.00 sec)
    > >>>
    > >>>
    > >>I don't have a system with DES available to me at the time. However,
    > >>have you also checked the version of OpenSSL you're using? MySQL uses
    > >>it to do the actual encryption and decryption.
    > >
    > >
    > > How can I check the version of OpenSSL?
    > >

    OpenSSL 0.9.7a Feb 19 2003

    > From a command line enter
    >
    > openssl version
    >
    >
    >
    > >
    > >>And the reason I suggested a CHAR field is because I did have problems
    > >>with VARCHAR when using DES. I suspect something was prematurely
    > >>detecting EOF.
    > >>
    > >>
    > >>--
    > >>==================
    > >>Remove the "x" from my email address
    > >>Jerry Stuckle
    > >>JDS Computer Training Corp.
    > >>jstucklexattglobal.net
    > >>==================
    > >
    > >
    > > Thanks
    > >
    >
    >
    > --
    > ==================
    > Remove the "x" from my email address
    > Jerry Stuckle
    > JDS Computer Training Corp.
    > [email]jstucklexattglobal.net[/email]
    > ==================
    Regards

    soup_or_power@yahoo.com Guest

  13. #13

    Default Re: DES acting strange


    Jerry Stuckle wrote:
    > [email]soup_or_power[/email] wrote:
    > > Jerry Stuckle wrote:
    > >
    > >>soup_or_power wrote:
    > >>
    > >>>Jerry Stuckle wrote:
    > >>>
    > >>>
    > >>>>soup_or_power wrote:
    > >>>>
    > >>>>
    > >>>>>Jerry Stuckle wrote:
    > >>>>>
    > >>>>>
    > >>>>>
    > >>>>>>soup_or_power wrote:
    > >>>>>>
    > >>>>>>
    > >>>>>>
    > >>>>>>>Used binary in the place of varchar to store the DES encrypted string
    > >>>>>>>in the table without any luck.
    > >>>>>>>soup_or_power wrote:
    > >>>>>>>
    > >>>>>>>
    > >>>>>>>
    > >>>>>>>
    > >>>>>>>>Jerry Stuckle wrote:
    > >>>>>>>>
    > >>>>>>>>
    > >>>>>>>>
    > >>>>>>>>
    > >>>>>>>>>soup_or_power wrote:
    > >>>>>>>>>
    > >>>>>>>>>
    > >>>>>>>>>
    > >>>>>>>>>
    > >>>>>>>>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    > >>>>>>>>>>I can't seem to encrypt the number 227968199 because I tried several
    > >>>>>>>>>>times and also tried other numbers which work fine.
    > >>>>>>>>>>
    > >>>>>>>>>>Here is a sample session:
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> create table `destest` (num varchar(17));
    > >>>>>>>>>>Query OK, 0 rows affected (0.04 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> desc destest;
    > >>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>>>>>| Field | Type | Null | Key | Default | Extra |
    > >>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>>>>>| num | varchar(17) | YES | | NULL | |
    > >>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    > >>>>>>>>>>1 row in set (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    > >>>>>>>>>>'sfG3853ncr1pt'));
    > >>>>>>>>>>Query OK, 1 row affected (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> select * from destest;
    > >>>>>>>>>>+------------------+
    > >>>>>>>>>>| num |
    > >>>>>>>>>>+------------------+
    > >>>>>>>>>>| Ԩ!?`f4~k |
    > >>>>>>>>>>+------------------+
    > >>>>>>>>>>1 row in set (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>| Ԩ!?`f4~k |
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>1 row in set (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    > >>>>>>>>>>'sfG3853ncr1pt'));
    > >>>>>>>>>>Query OK, 1 row affected (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    > >>>>>>>>>>
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>| Ԩ!?`f4~k |
    > >>>>>>>>>>| 12345678 |
    > >>>>>>>>>>+-----------------------------------+
    > >>>>>>>>>>2 rows in set (0.00 sec)
    > >>>>>>>>>>
    > >>>>>>>>>
    > >>>>>>>>>Used a char field in a varchar field.
    > >>>>>>>>
    > >>>>>>>>Using char instead of varchar will add NULL padding (C like strings).
    > >>>>>>>>But the problem remains unsolved
    > >>>>>>>>
    > >>>>>>>>mysql> create table `destest3` (num char(17));
    > >>>>>>>>Query OK, 0 rows affected (0.00 sec)
    > >>>>>>>>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    > >>>>>>>>'sfG3853ncr1pt '));
    > >>>>>>>>Query OK, 1 row affected (0.00 sec)
    > >>>>>>>>
    > >>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    > >>>>>>>>
    > >>>>>>>>+-----------------------------------+
    > >>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    > >>>>>>>>+-----------------------------------+
    > >>>>>>>>| Ԩ!?`f4~k |
    > >>>>>>>>+-----------------------------------+
    > >>>>>>>>1 row in set (0.00 sec)
    > >>>>>>>
    > >>>>>>>
    > >>>>>>I don't have a system with DES available to me at the time. However,
    > >>>>>>have you also checked the version of OpenSSL you're using? MySQL uses
    > >>>>>>it to do the actual encryption and decryption.
    > >>>>>
    > >>>>>
    > >>>>>How can I check the version of OpenSSL?
    > >>>>>
    > >>>
    > >>>
    > >>>
    > >>>OpenSSL 0.9.7a Feb 19 2003
    > >>>
    > >>>
    > >>>
    > >>>
    > >>>>From a command line enter
    > >>>>
    > >>>> openssl version
    > >>>>
    > >>>>
    > >>>>
    > >>>>
    > >>>>
    > >>>>>>And the reason I suggested a CHAR field is because I did have problems
    > >>>>>>with VARCHAR when using DES. I suspect something was prematurely
    > >>>>>>detecting EOF.
    > >>>>>>
    > >>>>>>
    > >>>>>>--
    > >>>>>>==================
    > >>>>>>Remove the "x" from my email address
    > >>>>>>Jerry Stuckle
    > >>>>>>JDS Computer Training Corp.
    > >>>>>>jstucklexattglobal.net
    > >>>>>>==================
    > >>>>>
    > >>>>>
    > >>>>>Thanks
    > >>>>>
    > >>>>
    > >>>>
    > >>>>--
    > >>>>==================
    > >>>>Remove the "x" from my email address
    > >>>>Jerry Stuckle
    > >>>>JDS Computer Training Corp.
    > >>>>jstucklexattglobal.net
    > >>>>==================
    > >>>
    > >>>
    > >>>Regards
    > >>>
    > >>
    > >>That should work fine. Did you actually change the field to a CHAR
    > >>instead of a VARCHAR? VARCHAR does not work with DES.
    > >>
    > >>I see the people on the MySQL bugs list told you the same thing.
    > >>
    > >>--
    > >>==================
    > >>Remove the "x" from my email address
    > >>Jerry Stuckle
    > >>JDS Computer Training Corp.
    > >>jstucklexattglobal.net
    > >>==================
    > >
    > >
    > > I tried CHAR and TINYBLOB. Both doesn't work.
    > > Thanks
    > >
    >
    > Did you verify it was in fact CHAR? TINYBLOB won't work - it must be a
    > fixed length column. Do you have any other VARCHAR columns in that
    > table? Some versions of MySQL don't allow mixing CHAR and VARCHAR
    > columns in the same table - the CHAR columns are automatically converted
    > to VARCHAR.
    I posted the code I am using to test. Please let me know if there is a
    fix without resorting to version upgrade or changes in the schema.
    Thanks

    soup_or_power@yahoo.com Guest

  14. #14

    Default Re: DES acting strange

    [email]soup_or_power[/email] wrote:
    > Jerry Stuckle wrote:
    >
    >>soup_or_power wrote:
    >>
    >>>Jerry Stuckle wrote:
    >>>
    >>>
    >>>>soup_or_power wrote:
    >>>>
    >>>>
    >>>>>Jerry Stuckle wrote:
    >>>>>
    >>>>>
    >>>>>
    >>>>>>soup_or_power wrote:
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>>Jerry Stuckle wrote:
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>
    >>>>>>>>soup_or_power wrote:
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>>Used binary in the place of varchar to store the DES encrypted string
    >>>>>>>>>in the table without any luck.
    >>>>>>>>>soup_or_power wrote:
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>>>Jerry Stuckle wrote:
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>
    >>>>>>>>>>>soup_or_power wrote:
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>>I use the DES_ENCRYPT and DES_DECRYPT with the string 'sfG3853ncr1pt'
    >>>>>>>>>>>>I can't seem to encrypt the number 227968199 because I tried several
    >>>>>>>>>>>>times and also tried other numbers which work fine.
    >>>>>>>>>>>>
    >>>>>>>>>>>>Here is a sample session:
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> create table `destest` (num varchar(17));
    >>>>>>>>>>>>Query OK, 0 rows affected (0.04 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> desc destest;
    >>>>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>>>>>>>| Field | Type | Null | Key | Default | Extra |
    >>>>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>>>>>>>| num | varchar(17) | YES | | NULL | |
    >>>>>>>>>>>>+-------+-------------+------+-----+---------+-------+
    >>>>>>>>>>>>1 row in set (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('227968199',
    >>>>>>>>>>>>'sfG3853ncr1pt'));
    >>>>>>>>>>>>Query OK, 1 row affected (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> select * from destest;
    >>>>>>>>>>>>+------------------+
    >>>>>>>>>>>>| num |
    >>>>>>>>>>>>+------------------+
    >>>>>>>>>>>>| Ԩ!?`f4~k |
    >>>>>>>>>>>>+------------------+
    >>>>>>>>>>>>1 row in set (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>| Ԩ!?`f4~k |
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>1 row in set (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> insert into destest(num) values(DES_ENCRYPT('12345678',
    >>>>>>>>>>>>'sfG3853ncr1pt'));
    >>>>>>>>>>>>Query OK, 1 row affected (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest;
    >>>>>>>>>>>>
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>| Ԩ!?`f4~k |
    >>>>>>>>>>>>| 12345678 |
    >>>>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>>>2 rows in set (0.00 sec)
    >>>>>>>>>>>>
    >>>>>>>>>>>
    >>>>>>>>>>>Used a char field in a varchar field.
    >>>>>>>>>>
    >>>>>>>>>>Using char instead of varchar will add NULL padding (C like strings).
    >>>>>>>>>>But the problem remains unsolved
    >>>>>>>>>>
    >>>>>>>>>>mysql> create table `destest3` (num char(17));
    >>>>>>>>>>Query OK, 0 rows affected (0.00 sec)
    >>>>>>>>>>mysql> insert into destest3(num) values(DES_ENCRYPT('227968199',
    >>>>>>>>>>'sfG3853ncr1pt '));
    >>>>>>>>>>Query OK, 1 row affected (0.00 sec)
    >>>>>>>>>>
    >>>>>>>>>>mysql> select DES_DECRYPT(num, 'sfG3853ncr1pt') from destest3;
    >>>>>>>>>>
    >>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>| DES_DECRYPT(num, 'sfG3853ncr1pt') |
    >>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>| Ԩ!?`f4~k |
    >>>>>>>>>>+-----------------------------------+
    >>>>>>>>>>1 row in set (0.00 sec)
    >>>>>>>>>
    >>>>>>>>>
    >>>>>>>>I don't have a system with DES available to me at the time. However,
    >>>>>>>>have you also checked the version of OpenSSL you're using? MySQL uses
    >>>>>>>>it to do the actual encryption and decryption.
    >>>>>>>
    >>>>>>>
    >>>>>>>How can I check the version of OpenSSL?
    >>>>>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>>OpenSSL 0.9.7a Feb 19 2003
    >>>>>
    >>>>>
    >>>>>
    >>>>>
    >>>>>>From a command line enter
    >>>>>
    >>>>>>openssl version
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>
    >>>>>>>>And the reason I suggested a CHAR field is because I did have problems
    >>>>>>>>with VARCHAR when using DES. I suspect something was prematurely
    >>>>>>>>detecting EOF.
    >>>>>>>>
    >>>>>>>>
    >>>>>>>>--
    >>>>>>>>==================
    >>>>>>>>Remove the "x" from my email address
    >>>>>>>>Jerry Stuckle
    >>>>>>>>JDS Computer Training Corp.
    >>>>>>>>jstucklexattglobal.net
    >>>>>>>>==================
    >>>>>>>
    >>>>>>>
    >>>>>>>Thanks
    >>>>>>>
    >>>>>>
    >>>>>>
    >>>>>>--
    >>>>>>==================
    >>>>>>Remove the "x" from my email address
    >>>>>>Jerry Stuckle
    >>>>>>JDS Computer Training Corp.
    >>>>>>jstucklexattglobal.net
    >>>>>>==================
    >>>>>
    >>>>>
    >>>>>Regards
    >>>>>
    >>>>
    >>>>That should work fine. Did you actually change the field to a CHAR
    >>>>instead of a VARCHAR? VARCHAR does not work with DES.
    >>>>
    >>>>I see the people on the MySQL bugs list told you the same thing.
    >>>>
    >>>>--
    >>>>==================
    >>>>Remove the "x" from my email address
    >>>>Jerry Stuckle
    >>>>JDS Computer Training Corp.
    >>>>jstucklexattglobal.net
    >>>>==================
    >>>
    >>>
    >>>I tried CHAR and TINYBLOB. Both doesn't work.
    >>>Thanks
    >>>
    >>
    >>Did you verify it was in fact CHAR? TINYBLOB won't work - it must be a
    >>fixed length column. Do you have any other VARCHAR columns in that
    >>table? Some versions of MySQL don't allow mixing CHAR and VARCHAR
    >>columns in the same table - the CHAR columns are automatically converted
    >>to VARCHAR.
    >
    >
    > I posted the code I am using to test. Please let me know if there is a
    > fix without resorting to version upgrade or changes in the schema.
    > Thanks
    >
    Not if you're using a VARCHAR field in your table. It doesn't work with
    the DES functions.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    [email]jstucklexattglobal.net[/email]
    ==================
    Jerry Stuckle Guest

Similar Threads

  1. Contribute Acting strange - template parameters withrepeating regions
    By fleetadmiralj in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: January 12th, 06:47 PM
  2. ASP Response.write() is acting strange.
    By JakeTheSnake3.0 in forum Macromedia Flash Data Integration
    Replies: 3
    Last Post: April 14th, 03:59 AM
  3. TIFF images acting strange
    By Engraver in forum Macromedia Freehand
    Replies: 5
    Last Post: June 28th, 05:32 PM
  4. Coldfusion 7/Dreamweaver Acting Strange
    By dynamed in forum Coldfusion - Getting Started
    Replies: 0
    Last Post: June 21st, 07:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139