rar20cipher.cpp

来自「7-Zip 是一款号称有着现今最高压缩比的压缩软件」· C++ 代码 · 共 36 行

CPP
36
字号
// Crypto/Rar20Cipher.cpp

#include "StdAfx.h"

#include "Rar20Cipher.h"
#include "Windows/Defs.h"

namespace NCrypto {
namespace NRar20 {

STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
{
  _coder.SetPassword(data, size);
  return S_OK;
}

STDMETHODIMP CDecoder::Init()
{
  return S_OK;
}

STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
{
  const UInt16 kBlockSize = 16;
  if (size > 0 && size < kBlockSize)
    return kBlockSize;
  UInt32 i;
  for (i = 0; i + kBlockSize <= size; i += kBlockSize)
  {
    _coder.DecryptBlock(data + i);
  }
  return i;
}

}}

⌨️ 快捷键说明

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