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

📄 base64.h

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

#include "cryptlib.h"
#include "filters.h"

class Base64Encoder : public Filter
{
public:
    Base64Encoder(BufferedTransformation *outQueue = new ByteQueue);

    void Put(byte inByte)
    {
        inBuf[inBufSize++]=inByte;
        if (inBufSize==3)
            EncodeQuantum();
    }

    void Put(const byte *inString, unsigned int length);
    void InputFinished();

private:
    void LineBreak();
    void EncodeQuantum();

    int inBufSize;
    int lineLength;
    byte inBuf[3];
};

class Base64Decoder : public Filter
{
public:
    Base64Decoder(BufferedTransformation *outQueue = new ByteQueue);

    void Put(byte inByte)
    {
        int i=ConvToNumber(inByte);
        if (i >= 0)
            inBuf[inBufSize++]=(byte) i;
        if (inBufSize==4)
            DecodeQuantum();
    }

    void Put(const byte *inString, unsigned int length);
    void InputFinished();

private:
    static int ConvToNumber(byte inByte);
    void DecodeQuantum();

    int inBufSize;
    byte inBuf[4];
};

#endif

⌨️ 快捷键说明

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