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

📄 randpool.h

📁 通訊保密編碼library project code.完整library project code!
💻 H
字号:
#ifndef RANDPOOL_H
#define RANDPOOL_H

#include "cryptlib.h"
#include "misc.h"

class RandomPool : public RandomNumberGenerator,
                   public BufferedTransformation
{
public:
    // poolSize must be greater than 16
    RandomPool(unsigned int poolSize=384);

    // interface for BufferedTransformation
    void Put(byte inByte);
    void Put(const byte *inString, unsigned int length);
    int Get(byte &outByte);
    unsigned int Get(byte *outString, unsigned int getMax);
    // return 0 to prevent infinite loops
    unsigned long MaxRetrieveable() {return 0;}

    // interface for RandomNumberGenerator
    byte GetByte()
        {byte b; RandomPool::Get(b); return b;}
    void GetBlock(byte *output, unsigned int size)
        {Get(output, size);}

protected:
    void Stir();

private:
    SecByteBlock pool, key;
    unsigned int addPos, getPos;
};

#endif

⌨️ 快捷键说明

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