当前位置: 首页>>代码示例>>C++>>正文


C++ NameValuePairs::GetValueWithDefault方法代码示例

本文整理汇总了C++中NameValuePairs::GetValueWithDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ NameValuePairs::GetValueWithDefault方法的具体用法?C++ NameValuePairs::GetValueWithDefault怎么用?C++ NameValuePairs::GetValueWithDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NameValuePairs的用法示例。


在下文中一共展示了NameValuePairs::GetValueWithDefault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ChannelInitialize

void Redirector::ChannelInitialize(const std::string &channel, const NameValuePairs &parameters, int propagation)
{
	if (channel.empty())
	{
		m_target = parameters.GetValueWithDefault("RedirectionTargetPointer", (BufferedTransformation*)NULL);
		m_passSignal = parameters.GetValueWithDefault("PassSignal", true);
	}

	if (m_target && m_passSignal)
		m_target->ChannelInitialize(channel, parameters, propagation);
}
开发者ID:randombit,项目名称:hacrypto,代码行数:11,代码来源:filters.cpp

示例2: IsolatedInitialize

void HexEncoder::IsolatedInitialize(const NameValuePairs &parameters)
{
    bool uppercase = parameters.GetValueWithDefault(Name::Uppercase(), true);
    m_filter->Initialize(CombinedNameValuePairs(
                             parameters,
                             MakeParameters(Name::EncodingLookupArray(), uppercase ? &s_vecUpper[0] : &s_vecLower[0], false)(Name::Log2Base(), 4, true)));
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:7,代码来源:hex.cpp

示例3: GenerateRandom

void InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
{
	int modulusSize = 2048;
	alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize);

	ASSERT( modulusSize >= 16 );

	m_e = alg.GetValueWithDefault("PublicExponent", Integer(17));

	ASSERT( m_e >= 3 );
	ASSERT( !m_e.IsEven() );

	RSAPrimeSelector selector(m_e);
	const NameValuePairs &primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize)
		("PointerToPrimeSelector", selector.GetSelectorPointer());
	m_p.GenerateRandom(rng, primeParam);
	m_q.GenerateRandom(rng, primeParam);

	m_d = EuclideanMultiplicativeInverse(m_e, LCM(m_p-1, m_q-1));
	assert(m_d.IsPositive());

	m_dp = m_d % (m_p-1);
	m_dq = m_d % (m_q-1);
	m_n = m_p * m_q;
	m_u = m_q.InverseMod(m_p);
}
开发者ID:sigatrev,项目名称:Stepmania-3.95,代码行数:26,代码来源:rsa.cpp

示例4: IsolatedInitialize

void BaseN_Encoder::IsolatedInitialize(const NameValuePairs &parameters)
{
	parameters.GetRequiredParameter("BaseN_Encoder", "EncodingLookupArray", m_alphabet);

	parameters.GetRequiredIntParameter("BaseN_Encoder", "Log2Base", m_bitsPerChar);
	if (m_bitsPerChar <= 0 || m_bitsPerChar >= 8)
		throw InvalidArgument("BaseN_Encoder: Log2Base must be between 1 and 7 inclusive");

	byte padding;
	bool pad;
	if (parameters.GetValue("PaddingByte", padding))
		pad = parameters.GetValueWithDefault("Pad", true);
	else
		pad = false;
	m_padding = pad ? padding : -1;

	m_bytePos = m_bitPos = 0;

	int i = 8;
	while (i%m_bitsPerChar != 0)
		i += 8;
	m_outputBlockSize = i/m_bitsPerChar;

	m_outBuf.New(m_outputBlockSize);
}
开发者ID:ste93,项目名称:thesis_code,代码行数:25,代码来源:basecode.cpp

示例5: GenerateRandom

void DL_GroupParameters_DSA::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
{
	Integer p, q, g;

	if (alg.GetValue("Modulus", p) && alg.GetValue("SubgroupGenerator", g))
	{
		q = alg.GetValueWithDefault("SubgroupOrder", ComputeGroupOrder(p)/2);
	}
	else
	{
		int modulusSize = 1024;
		alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize);

		if (!DSA::IsValidPrimeLength(modulusSize))
			throw InvalidArgument("DSA: not a valid prime length");

		SecByteBlock seed(SHA::DIGESTSIZE);
		Integer h;
		int c;

		do
		{
			rng.GenerateBlock(seed, SHA::DIGESTSIZE);
		} while (!DSA::GeneratePrimes(seed, SHA::DIGESTSIZE*8, c, p, modulusSize, q));

		do
		{
			h.Randomize(rng, 2, p-2);
			g = a_exp_b_mod_c(h, (p-1)/q, p);
		} while (g <= 1);
	}

	Initialize(p, q, g);
}
开发者ID:axxapp,项目名称:winxgui,代码行数:34,代码来源:gfpcrypt.cpp

示例6: GenerateRandom

void DL_GroupParameters_DSA::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
{
	Integer p, q, g;

	if (alg.GetValue("Modulus", p) && alg.GetValue("SubgroupGenerator", g))
	{
		q = alg.GetValueWithDefault("SubgroupOrder", ComputeGroupOrder(p)/2);
		Initialize(p, q, g);
	}
	else
	{
		int modulusSize = 1024, defaultSubgroupOrderSize;
		alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize);

		switch (modulusSize)
		{
		case 1024:
			defaultSubgroupOrderSize = 160;
			break;
		case 2048:
			defaultSubgroupOrderSize = 224;
			break;
		case 3072:
			defaultSubgroupOrderSize = 256;
			break;
		default:
			throw InvalidArgument("DSA: not a valid prime length");
		}

		DL_GroupParameters_GFP::GenerateRandom(rng, CombinedNameValuePairs(alg, MakeParameters(Name::SubgroupOrderSize(), defaultSubgroupOrderSize, false)));
	}
}
开发者ID:PearsonDevelopersNetwork,项目名称:LearningStudio-HelloWorld-Python,代码行数:32,代码来源:gfpcrypt.cpp

示例7: Initialize

void Redirector::Initialize(const NameValuePairs &parameters, int propagation)
{
	m_target = parameters.GetValueWithDefault("RedirectionTargetPointer", (BufferedTransformation*)NULL);
	m_behavior = parameters.GetIntValueWithDefault("RedirectionBehavior", PASS_EVERYTHING);

	if (m_target && GetPassSignals())
		m_target->Initialize(parameters, propagation);
}
开发者ID:prakhs123,项目名称:cryptopp,代码行数:8,代码来源:filters.cpp

示例8: InitializeDerivedAndReturnNewSizes

void SignatureVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs &parameters, unsigned int &firstSize, unsigned int &blockSize, unsigned int &lastSize)
{
	m_flags = parameters.GetValueWithDefault(Name::SignatureVerificationFilterFlags(), (word32)DEFAULT_FLAGS);
	m_messageAccumulator.reset(m_verifier.NewVerificationAccumulator());
	unsigned int size = m_verifier.SignatureLength();
	m_verified = false;
	firstSize = m_flags & SIGNATURE_AT_BEGIN ? size : 0;
	blockSize = 1;
	lastSize = m_flags & SIGNATURE_AT_BEGIN ? 0 : size;
}
开发者ID:randombit,项目名称:hacrypto,代码行数:10,代码来源:filters.cpp

示例9: InitializeDerivedAndReturnNewSizes

void HashVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs &parameters, unsigned int &firstSize, unsigned int &blockSize, unsigned int &lastSize)
{
	m_flags = parameters.GetValueWithDefault(Name::HashVerificationFilterFlags(), (word32)DEFAULT_FLAGS);
	m_hashModule.Restart();
	unsigned int size = m_hashModule.DigestSize();
	m_verified = false;
	firstSize = m_flags & HASH_AT_BEGIN ? size : 0;
	blockSize = 1;
	lastSize = m_flags & HASH_AT_BEGIN ? 0 : size;
}
开发者ID:jratcliff63367,项目名称:compressiontest,代码行数:10,代码来源:filters.cpp

示例10: InitializeDerivedAndReturnNewSizes

void HashVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs &parameters, size_t &firstSize, size_t &blockSize, size_t &lastSize)
{
	m_flags = parameters.GetValueWithDefault(Name::HashVerificationFilterFlags(), (word32)DEFAULT_FLAGS);
	int s = parameters.GetIntValueWithDefault(Name::TruncatedDigestSize(), -1);
	m_digestSize = s < 0 ? m_hashModule.DigestSize() : s;
	m_verified = false;
	firstSize = m_flags & HASH_AT_BEGIN ? m_digestSize : 0;
	blockSize = 1;
	lastSize = m_flags & HASH_AT_BEGIN ? 0 : m_digestSize;
}
开发者ID:prakhs123,项目名称:cryptopp,代码行数:10,代码来源:filters.cpp

示例11: MakeParameters

void Base64Encoder::IsolatedInitialize(const NameValuePairs &parameters)
{
    bool insertLineBreaks = parameters.GetValueWithDefault(Name::InsertLineBreaks(), true);
    int maxLineLength = parameters.GetIntValueWithDefault(Name::MaxLineLength(), 72);

    const char *lineBreak = insertLineBreaks ? "\n" : "";

    m_filter->Initialize(CombinedNameValuePairs(
                             parameters,
                             MakeParameters(Name::EncodingLookupArray(), &s_vec[0], false)
                             (Name::PaddingByte(), s_padding)
                             (Name::GroupSize(), insertLineBreaks ? maxLineLength : 0)
                             (Name::Separator(), ConstByteArrayParameter(lineBreak))
                             (Name::Terminator(), ConstByteArrayParameter(lineBreak))
                             (Name::Log2Base(), 6, true)));
}
开发者ID:hugosepulveda,项目名称:MaidSafe,代码行数:16,代码来源:base64.cpp

示例12: IsolatedInitialize

void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
{
	const char *fileName;
	if (parameters.GetValue("OutputFileName", fileName))
	{
		ios::openmode binary = parameters.GetValueWithDefault("OutputBinaryMode", true) ? ios::binary : ios::openmode(0);
		m_file.open(fileName, ios::out | ios::trunc | binary);
		if (!m_file)
			throw OpenErr(fileName);
		m_stream = &m_file;
	}
	else
	{
		m_stream = NULL;
		parameters.GetValue("OutputStreamPointer", m_stream);
	}
}
开发者ID:randombit,项目名称:hacrypto,代码行数:17,代码来源:files.cpp

示例13: StoreInitialize

void FileStore::StoreInitialize(const NameValuePairs &parameters)
{
	const char *fileName;
	if (parameters.GetValue("InputFileName", fileName))
	{
		ios::openmode binary = parameters.GetValueWithDefault("InputBinaryMode", true) ? ios::binary : ios::openmode(0);
		m_file.open(fileName, ios::in | binary);
		if (!m_file)
			throw OpenErr(fileName);
		m_stream = &m_file;
	}
	else
	{
		m_stream = NULL;
		parameters.GetValue("InputStreamPointer", m_stream);
	}
	m_waiting = false;
}
开发者ID:randombit,项目名称:hacrypto,代码行数:18,代码来源:files.cpp

示例14: IsolatedInitialize

void FileSink::IsolatedInitialize(const NameValuePairs &parameters)
{
	m_file.reset(new std::ofstream);
	const char *fileName;
	if (parameters.GetValue(Name::OutputFileName(), fileName))
	{
		ios::openmode binary = parameters.GetValueWithDefault(Name::OutputBinaryMode(), true) ? ios::binary : ios::openmode(0);
		m_file->open(fileName, ios::out | ios::trunc | binary);
		if (!*m_file)
			throw OpenErr(fileName);
		m_stream = m_file.get();
	}
	else
	{
		m_stream = NULL;
		parameters.GetValue(Name::OutputStreamPointer(), m_stream);
	}
}
开发者ID:LjApps,项目名称:eMule-VeryCD,代码行数:18,代码来源:files.cpp

示例15: GenerateRandom

void InvertibleESIGNFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &param)
{
	int modulusSize = 1023*2;
	param.GetIntValue("ModulusSize", modulusSize) || param.GetIntValue("KeySize", modulusSize);

	if (modulusSize < 24)
		throw InvalidArgument("InvertibleESIGNFunction: specified modulus size is too small");

	if (modulusSize % 3 != 0)
		throw InvalidArgument("InvertibleESIGNFunction: modulus size must be divisible by 3");

	m_e = param.GetValueWithDefault("PublicExponent", Integer(32));

	if (m_e < 8)
		throw InvalidArgument("InvertibleESIGNFunction: public exponents less than 8 may not be secure");

	// VC70 workaround: putting these after primeParam causes overlapped stack allocation
	ConstByteArrayParameter seedParam;
	SecByteBlock seed;

	const Integer minP = Integer(204) << (modulusSize/3-8);
	const Integer maxP = Integer::Power2(modulusSize/3)-1;
	AlgorithmParameters primeParam = MakeParameters("Min", minP)("Max", maxP)("RandomNumberType", Integer::PRIME);

	if (param.GetValue("Seed", seedParam))
	{
		seed.resize(seedParam.size() + 4);
		memcpy(seed + 4, seedParam.begin(), seedParam.size());

		PutWord(false, BIG_ENDIAN_ORDER, seed, (word32)0);
		m_p.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("Seed", ConstByteArrayParameter(seed))));
		PutWord(false, BIG_ENDIAN_ORDER, seed, (word32)1);
		m_q.GenerateRandom(rng, CombinedNameValuePairs(primeParam, MakeParameters("Seed", ConstByteArrayParameter(seed))));
	}
	else
	{
		m_p.GenerateRandom(rng, primeParam);
		m_q.GenerateRandom(rng, primeParam);
	}

	m_n = m_p * m_p * m_q;

	CRYPTOPP_ASSERT(m_n.BitCount() == (unsigned int)modulusSize);
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:44,代码来源:esign.cpp


注:本文中的NameValuePairs::GetValueWithDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。