seal_gam.cpp
来自「含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种Chec」· C++ 代码 · 共 42 行
CPP
42 行
/************************************************** SEAL Gamma Function Source File ** (C) 1999-2002 The Botan Project **************************************************/#include <botan/seal_gam.h>#include <botan/sha1.h>namespace Botan {/************************************************** Gamma Constructor **************************************************/Gamma::Gamma(const byte UK[20]) { for(u32bit j = 0; j != 5; j++) K[j] = make_u32bit(UK[4*j], UK[4*j+1], UK[4*j+2], UK[4*j+3]); last_index = 0xFFFFFFFF; }/************************************************** Gamma Function **************************************************/u32bit Gamma::operator()(u32bit index) { u32bit new_index = index / 5; if(new_index != last_index) { SecureBuffer<byte, 80> W; for(u32bit j = 0; j != 4; j++) W[j] = get_byte(j, new_index); SHA1 sha1; sha1.digest = K; sha1.hash(W); digest = sha1.digest; last_index = new_index; } return digest[index % 5]; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?