📄 deskey.h
字号:
/*
* Header file for class of representing des keys
* 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 DESKEY_H
#define DESKEY_H
#include <vector>
using std::vector;
#include "spbitset.h"
class deskey
{
public:
typedef spbitset<64> key_t;
typedef vector<key_t> keys_t;
typedef keys_t::iterator iterator;
typedef keys_t::reverse_iterator reverse_iterator;
deskey(unsigned _int64 key);
~deskey(void);
iterator begin()
{
return keys.begin();
}
iterator end()
{
return keys.end();
}
reverse_iterator rbegin()
{
return keys.rbegin();
}
reverse_iterator rend()
{
return keys.rend();
}
deskey& operator=(const deskey& rhs)
{
if (this != &rhs)
{
keys = rhs.keys;
}
return *this;
}
private:
/*
* gnerate the 16 keys from 64 bits key
* according to des key generation algorithm
*/
void genkey(unsigned _int64 key);
private:
/*
* store the 16 keys generated by genkey
*/
keys_t keys;
static size_t pmd1[];
static size_t loop[];
static size_t pmd2[];
/*
* low 48 bits selector
*/
static key_t lo48;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -