blumshub.h

来自「各种加密算法的源代码」· C头文件 代码 · 共 32 行

H
32
字号
#ifndef BLUMSHUB_H
#define BLUMSHUB_H

#include "cryptlib.h"
#include "bignum.h"

class BlumBlumShub : public RandomNumberGenerator,
                     public RandomAccessStreamCipher
{
public:
    // Make sure key1 and key2 are both Blum integers at least 512 bits long,
    // and seed should be about as big as p*q
    BlumBlumShub(const bignum &key1, const bignum &key2, const bignum &seed);

    int GetBit();
    byte GetByte();

    byte ProcessByte(byte input)
        {return (input ^ GetByte());}

    void Seek(unsigned long index);

private:
    const bignum phi, n, x0;
    bignum current;
    const int maxBits;
    int bitsLeft;
};

#endif

⌨️ 快捷键说明

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