2
* Copyright (C) 2001-2005 Jacek Sieka, arnetheduck on gmail point com
2
* Copyright (C) 2001-2006 Jacek Sieka, arnetheduck on gmail point com
4
4
* This program is free software; you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
16
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
#if !defined(AFX_CRYPTO_H__28F66860_0AD5_44AD_989C_BA4326C42F46__INCLUDED_)
20
#define AFX_CRYPTO_H__28F66860_0AD5_44AD_989C_BA4326C42F46__INCLUDED_
19
#if !defined(CRYPTO_MANAGER_H)
20
#define CRYPTO_MANAGER_H
22
22
#if _MSC_VER > 1000
49
Node(int aChr, int aWeight) : chr(aChr), weight(aWeight), left(NULL), right(NULL) { };
50
Node(Node* aLeft, Node* aRight) : chr(-1), weight(aLeft->weight + aRight->weight), left(aLeft), right(aRight) { };
49
Node(int aChr, int aWeight) : chr(aChr), weight(aWeight), left(NULL), right(NULL) { }
50
Node(Node* aLeft, Node* aRight) : chr(-1), weight(aLeft->weight + aRight->weight), left(aLeft), right(aRight) { }
75
75
string makeKey(const string& aLock);
76
const string& getLock() { return lock; };
77
const string& getPk() { return pk; };
78
bool isExtended(const string& aLock) { return strncmp(aLock.c_str(), "EXTENDEDPROTOCOL", 16) == 0; };
76
const string& getLock() { return lock; }
77
const string& getPk() { return pk; }
78
bool isExtended(const string& aLock) { return strncmp(aLock.c_str(), "EXTENDEDPROTOCOL", 16) == 0; }
80
80
void decodeHuffman(const u_int8_t* /*is*/, string& /*os*/, const size_t /*len*/) throw(CryptoException);
81
void encodeHuffman(const string& is, string& os);
82
81
void decodeBZ2(const u_int8_t* is, size_t sz, string& os) throw(CryptoException);
85
84
friend class Singleton<CryptoManager>;
87
CryptoManager() : lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { };
88
virtual ~CryptoManager() { };
86
CryptoManager() : lock("EXTENDEDPROTOCOLABCABCABCABCABCABC"), pk("DCPLUSPLUS" VERSIONSTRING "ABCABC") { }
87
virtual ~CryptoManager() { }
90
89
class Leaf : public FastAlloc<Leaf> {
94
Leaf(int aChr, int aLen) : chr(aChr), len(aLen) { };
95
Leaf() : chr(-1), len(-1) { };
93
Leaf(int aChr, int aLen) : chr(aChr), len(aLen) { }
94
Leaf() : chr(-1), len(-1) { }
98
97
class DecNode : public FastAlloc<DecNode> {
103
DecNode(int aChr) : chr(aChr), left(NULL), right(NULL) { };
104
DecNode(DecNode* aLeft, DecNode* aRight) : chr(-1), left(aLeft), right(aRight) { };
105
DecNode() : chr(-1), left(NULL), right(NULL) { };
102
DecNode(int aChr) : chr(aChr), left(NULL), right(NULL) { }
103
DecNode(DecNode* aLeft, DecNode* aRight) : chr(-1), left(aLeft), right(aRight) { }
104
DecNode() : chr(-1), left(NULL), right(NULL) { }