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

📄 rng.h

📁 各种加密算法的集合
💻 H
字号:
  #ifndef RNG_H 
#define RNG_H 

#include "cryptlib.h" 

// linear congruential generator 
// originally by William S. England 

// do not use for cryptographic purposes 

class LC_RNG : public RandomNumberGenerator 
{ 
public: 
LC_RNG(word32 init_seed) 
: seedptr((byte *)&amt;seed) {seed=init_seed;} 

byte GetByte(); 

private: 
word32 seed; 
byte *const seedptr; 

static const word32 m; 
static const word32 q; 
static const word16 a; 
static const word16 r; 
}; 

// RNG derived from ANSI X9.17 Appendix C 

class X917RNG : public RandomNumberGenerator 
{ 
public: 
// cipher will be deleted by destructor 
X917RNG(BlockTransformation *cipher, const byte *seed); 
~X917RNG(); 

byte GetByte(); 

private: 
BlockTransformation *const cipher; 
const int S; // blocksize of cipher 
byte *const dtbuf; // buffer for enciphered timestamp 
byte *const randseed; 
byte *const randbuf; 
int randbuf_counter; // # of unused bytes left in randbuf 
}; 

#endif 

⌨️ 快捷键说明

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