My Project
|
00001 #ifndef SQL_CRYPT_INCLUDED 00002 #define SQL_CRYPT_INCLUDED 00003 00004 /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; version 2 of the License. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License 00016 along with this program; if not, write to the Free Software Foundation, 00017 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */ 00018 00019 00020 #include "sql_alloc.h" 00021 #include "mysql_com.h" /* rand_struct */ 00022 00023 class SQL_CRYPT :public Sql_alloc 00024 { 00025 struct rand_struct rand,org_rand; 00026 char decode_buff[256],encode_buff[256]; 00027 uint shift; 00028 public: 00029 SQL_CRYPT() {} 00030 SQL_CRYPT(ulong *seed) 00031 { 00032 init(seed); 00033 } 00034 ~SQL_CRYPT() {} 00035 void init(ulong *seed); 00036 void reinit() { shift=0; rand=org_rand; } 00037 void encode(char *str, uint length); 00038 void decode(char *str, uint length); 00039 }; 00040 00041 #endif /* SQL_CRYPT_INCLUDED */