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

📄 des.h

📁 DES算法原理及实现,实现了3DES和DES的程序过程
💻 H
字号:
/*
*	 Header file for class of representing des algorithm
*    Copyright (C) 2007  Stone
*
*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*    Contact me by stoneyrh@163.com 
*
*/
#ifndef DES_H
#define DES_H

#include "deskey.h"

#define DEFAULT_KEY 0XEB0AA5155328513BL

class des
{
public:
	/*
	* use DEFAULT_KEY as the key
	*/
	des(void);
	/*
	* spedify a key
	*/
	des(unsigned _int64 key);
	~des(void);

	/*
	* set the key to another key
	*/
	void setkey(unsigned _int64 key);

	/*
	* encypt the data pointed by dpointer
	* if succeed, return true, otherwise false
	* count specifies how many unsigned _int64 
	* contained in the memory pointed by dpointer
	* when return true, dpointer also point to the 
	* encrypted data
	*/
	bool encrypt(unsigned _int64* dpointer,unsigned _int64 count);
	/*
	* decypt the data pointed by dpointer
	* if succeed, return true, otherwise false
	* count specifies how many unsigned _int64 
	* contained in the memory pointed by dpointer
	* when return true, dpointer also point to the 
	* decrypted data
	*/
	bool decrypt(unsigned _int64* dpointer,unsigned _int64 count);

private:
	deskey dkey;
};

#endif

⌨️ 快捷键说明

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