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

📄 rc4.h

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

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

class RC4 : public RandomNumberGenerator,
            public StreamCipher
{
public:
    enum {KEYLENGTH=16};    // default key length

    RC4(const byte *userKey, int keyLength=KEYLENGTH);
    ~RC4();

    inline byte GetByte()
    {
        x++;
        y += state[x];
        swap(state[x], state[y]);
        return (state[(state[x] + state[y]) & 255]);
    }

    inline byte ProcessByte(byte input)
        {return (input ^ RC4::GetByte());}

    void ProcessString(byte *outString, const byte *inString, unsigned int length);
    void ProcessString(byte *inoutString, unsigned int length);

private:
    byte *const state;
    byte x;
    byte y;
};

#endif

⌨️ 快捷键说明

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