⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 griddle.h

📁 一个非常有用的开源代码
💻 H
字号:
/*	Copyright (C) 2006, Mike Gashler	This library is free software; you can redistribute it and/or	modify it under the terms of the GNU Lesser General Public	License as published by the Free Software Foundation; either	version 2.1 of the License, or (at your option) any later version.	see http://www.gnu.org/copyleft/lesser.html*/#ifndef __GRIDDLE_H__#define __GRIDDLE_H__class GRand;class GXMLTag;class GKeyPair;// This class is meant for fighting denial-of-service attacks against a server by requiring// the client to solve a riddle (a computationally intensive process) before further service// will be given.class GRiddle{protected:	int m_nTotalBytes;	int m_nMysteryBits;	unsigned char* m_pRiddle;	unsigned char* m_pDigest;	char* m_pSignature;public:	GRiddle();	virtual ~GRiddle();	unsigned char* GetDigest() { return m_pDigest; }	int GetDigestByteCount();	unsigned char* GetRiddle() { return m_pRiddle; }	int GetRiddleTotalByteCount() { return m_nTotalBytes; }	int GetUnknownBitCount() { return m_nMysteryBits; }	bool GenerateRiddle(GRand* pRand, int nTotalBytes, int nMysteryBits);	bool Solve();	bool CheckAnswer();	GXMLTag* ToXML(bool IncludeAnswer);	bool FromXML(GXMLTag* pTag);	void Sign(GKeyPair* pKeyPair);	bool CheckSignature(GKeyPair* pKeyPair);protected:	void DigestRiddle(unsigned char* pOutput);	void SetSignature(const char* szSig);};#endif // __GRIDDLE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -