📄 seal_gam.cpp
字号:
/************************************************** 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -