nhash.cpp
来自「realization of hash function」· C++ 代码 · 共 29 行
CPP
29 行
#include "Stdafx.h"
NHash::NHash(int n):
N(n)
{
fill_n(v.b, 16, 170); // 10101010...
}
void NHash::do_it(istream& inputStream, ostream& outputStream)
{
inputStream.seekg(0, ios::end);
unsigned int streamLength = inputStream.tellg();
inputStream.seekg(0, ios::beg);
while (!inputStream.eof())
{
bit128 M;
inputStream.read(M.b, 16);
int readCount = inputStream.gcount();
if (readCount == 16) g(M);
else if (readCount == 8)
{
M.a[2] = M.a[0];
M.a[3] = M.a[1];
g(M);
}
else if (readCount >= 1 && readCount <= 7)
{
M.b[readCount] = static_cast<unsigned char> (128); // 耠邃簋
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?