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

📄 emsa2.cpp

📁 lots Elliptic curve cryptography codes. Use Visual c++ to compile
💻 CPP
字号:
// emsa2.cpp - written and placed in the public domain by Wei Dai#include "pch.h"#include "emsa2.h"#ifndef CRYPTOPP_IMPORTSNAMESPACE_BEGIN(CryptoPP)void EMSA2Pad::ComputeMessageRepresentative(RandomNumberGenerator &rng, 	const byte *recoverableMessage, size_t recoverableMessageLength,	HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,	byte *representative, size_t representativeBitLength) const{	assert(representativeBitLength >= MinRepresentativeBitLength(hashIdentifier.second, hash.DigestSize()));	if (representativeBitLength % 8 != 7)		throw PK_SignatureScheme::InvalidKeyLength("EMSA2: EMSA2 requires a key length that is a multiple of 8");	size_t digestSize = hash.DigestSize();	size_t representativeByteLength = BitsToBytes(representativeBitLength);	representative[0] = messageEmpty ? 0x4b : 0x6b;	memset(representative+1, 0xbb, representativeByteLength-digestSize-4);	// pad with 0xbb	byte *afterP2 = representative+representativeByteLength-digestSize-3;	afterP2[0] = 0xba;	hash.Final(afterP2+1);	representative[representativeByteLength-2] = *hashIdentifier.first;	representative[representativeByteLength-1] = 0xcc;}NAMESPACE_END#endif

⌨️ 快捷键说明

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