#include <sql_crypt.h>
Inheritance diagram for SQL_CRYPT:


Public Member Functions | |
| SQL_CRYPT (const char *seed) | |
| SQL_CRYPT (ulong *seed) | |
| ~SQL_CRYPT () | |
| void | init () |
| void | encode (char *str, uint length) |
| void | decode (char *str, uint length) |
Private Member Functions | |
| void | crypt_init (ulong *seed) |
Private Attributes | |
| rand_struct rand | org_rand |
| char | decode_buff [256] |
| char | encode_buff [256] |
| uint | shift |
Definition at line 22 of file sql_crypt.h.
| SQL_CRYPT::SQL_CRYPT | ( | const char * | seed | ) |
Definition at line 32 of file sql_crypt.cc.
References crypt_init(), hash_password(), and strlen().
00033 { 00034 ulong rand_nr[2]; 00035 hash_password(rand_nr,password, strlen(password)); 00036 crypt_init(rand_nr); 00037 }
Here is the call graph for this function:

| SQL_CRYPT::SQL_CRYPT | ( | ulong * | seed | ) | [inline] |
Definition at line 30 of file sql_crypt.h.
References crypt_init().
00031 { 00032 crypt_init(seed); 00033 }
Here is the call graph for this function:

| SQL_CRYPT::~SQL_CRYPT | ( | ) | [inline] |
| void SQL_CRYPT::crypt_init | ( | ulong * | seed | ) | [private] |
Definition at line 39 of file sql_crypt.cc.
References decode_buff, encode_buff, my_rnd(), org_rand, randominit(), and shift.
Referenced by SQL_CRYPT().
00040 { 00041 uint i; 00042 randominit(&rand,rand_nr[0],rand_nr[1]); 00043 00044 for (i=0 ; i<=255; i++) 00045 decode_buff[i]= (char) i; 00046 00047 for (i=0 ; i<= 255 ; i++) 00048 { 00049 int idx= (uint) (my_rnd(&rand)*255.0); 00050 char a= decode_buff[idx]; 00051 decode_buff[idx]= decode_buff[i]; 00052 decode_buff[+i]=a; 00053 } 00054 for (i=0 ; i <= 255 ; i++) 00055 encode_buff[(uchar) decode_buff[i]]=i; 00056 org_rand=rand; 00057 shift=0; 00058 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void SQL_CRYPT::decode | ( | char * | str, | |
| uint | length | |||
| ) |
Definition at line 73 of file sql_crypt.cc.
References decode_buff, my_rnd(), and shift.
Referenced by Item_func_decode::val_str().
00074 { 00075 for (uint i=0; i < length; i++) 00076 { 00077 shift^=(uint) (my_rnd(&rand)*255.0); 00078 uint idx= (uint) ((uchar) str[0] ^ shift); 00079 *str = decode_buff[idx]; 00080 shift^= (uint) (uchar) *str++; 00081 } 00082 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void SQL_CRYPT::encode | ( | char * | str, | |
| uint | length | |||
| ) |
Definition at line 61 of file sql_crypt.cc.
References encode_buff, my_rnd(), and shift.
Referenced by mysql_create_frm(), and Item_func_encode::val_str().
00062 { 00063 for (uint i=0; i < length; i++) 00064 { 00065 shift^=(uint) (my_rnd(&rand)*255.0); 00066 uint idx= (uint) (uchar) str[0]; 00067 *str++ = (char) ((uchar) encode_buff[idx] ^ shift); 00068 shift^= idx; 00069 } 00070 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void SQL_CRYPT::init | ( | ) | [inline] |
Definition at line 35 of file sql_crypt.h.
References org_rand, and shift.
Referenced by Item_func_decode::val_str(), and Item_func_encode::val_str().
Here is the caller graph for this function:

char SQL_CRYPT::decode_buff[256] [private] |
char SQL_CRYPT::encode_buff[256] [private] |
struct rand_struct rand SQL_CRYPT::org_rand [private] |
uint SQL_CRYPT::shift [private] |
Definition at line 26 of file sql_crypt.h.
Referenced by crypt_init(), decode(), encode(), and init().
1.4.7

