1#ifndef SQL_CRYPT_INCLUDED
2#define SQL_CRYPT_INCLUDED
3
4/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
19
20#ifdef USE_PRAGMA_INTERFACE
21#pragma interface /* gcc class implementation */
22#endif
23
24#include "sql_alloc.h" /* Sql_alloc */
25#include "my_rnd.h" /* rand_struct */
26
27class SQL_CRYPT :public Sql_alloc
28{
29 struct my_rnd_struct rand,org_rand;
30 char decode_buff[256],encode_buff[256];
31 uint shift;
32 public:
33 SQL_CRYPT() {}
34 SQL_CRYPT(ulong *seed)
35 {
36 init(seed);
37 }
38 ~SQL_CRYPT() {}
39 void init(ulong *seed);
40 void reinit() { shift=0; rand=org_rand; }
41 void encode(char *str, uint length);
42 void decode(char *str, uint length);
43};
44
45#endif /* SQL_CRYPT_INCLUDED */
46