本文整理汇总了C++中NameValuePairs::GetIntValueWithDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ NameValuePairs::GetIntValueWithDefault方法的具体用法?C++ NameValuePairs::GetIntValueWithDefault怎么用?C++ NameValuePairs::GetIntValueWithDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameValuePairs
的用法示例。
在下文中一共展示了NameValuePairs::GetIntValueWithDefault方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDefaultDiscardBytes
void ARC4_Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keyLen);
m_x = 1;
m_y = 0;
unsigned int i;
for (i=0; i<256; i++)
m_state[i] = i;
unsigned int keyIndex = 0, stateIndex = 0;
for (i=0; i<256; i++)
{
unsigned int a = m_state[i];
stateIndex += key[keyIndex] + a;
stateIndex &= 0xff;
m_state[i] = m_state[stateIndex];
m_state[stateIndex] = a;
if (++keyIndex >= keyLen)
keyIndex = 0;
}
int discardBytes = params.GetIntValueWithDefault("DiscardBytes", GetDefaultDiscardBytes());
DiscardBytes(discardBytes);
}
示例2: IsolatedInitialize
void RawIDA::IsolatedInitialize(const NameValuePairs ¶meters)
{
if (!parameters.GetIntValue("RecoveryThreshold", m_threshold))
throw InvalidArgument("RawIDA: missing RecoveryThreshold argument");
CRYPTOPP_ASSERT(m_threshold > 0);
if (m_threshold <= 0)
throw InvalidArgument("RawIDA: RecoveryThreshold must be greater than 0");
m_lastMapPosition = m_inputChannelMap.end();
m_channelsReady = 0;
m_channelsFinished = 0;
m_w.New(m_threshold);
m_y.New(m_threshold);
m_inputQueues.reserve(m_threshold);
m_outputChannelIds.clear();
m_outputChannelIdStrings.clear();
m_outputQueues.clear();
word32 outputChannelID;
if (parameters.GetValue("OutputChannelID", outputChannelID))
AddOutputChannel(outputChannelID);
else
{
int nShares = parameters.GetIntValueWithDefault("NumberOfShares", m_threshold);
CRYPTOPP_ASSERT(nShares > 0);
if (nShares <= 0) {nShares = m_threshold;}
for (unsigned int i=0; i< (unsigned int)(nShares); i++)
AddOutputChannel(i);
}
}
示例3: Initialize
void Redirector::Initialize(const NameValuePairs ¶meters, 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);
}
示例4: InitializeDerivedAndReturnNewSizes
void HashVerificationFilter::InitializeDerivedAndReturnNewSizes(const NameValuePairs ¶meters, 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;
}
示例5: IsolatedInitialize
void Grouper::IsolatedInitialize(const NameValuePairs ¶meters)
{
m_groupSize = parameters.GetIntValueWithDefault("GroupSize", 0);
ConstByteArrayParameter seperator, terminator;
if (m_groupSize)
parameters.GetRequiredParameter("Grouper", "Seperator", seperator);
else
parameters.GetValue("Seperator", seperator);
parameters.GetValue("Terminator", terminator);
m_seperator.Assign(seperator.begin(), seperator.size());
m_terminator.Assign(terminator.begin(), terminator.size());
m_counter = 0;
}
示例6: SetKeyWithoutResync
void CCM_Base::SetKeyWithoutResync(const byte *userKey, size_t keylength, const NameValuePairs ¶ms)
{
BlockCipher &blockCipher = AccessBlockCipher();
blockCipher.SetKey(userKey, keylength, params);
if (blockCipher.BlockSize() != REQUIRED_BLOCKSIZE)
throw InvalidArgument(AlgorithmName() + ": block size of underlying block cipher is not 16");
m_digestSize = params.GetIntValueWithDefault(Name::DigestSize(), DefaultDigestSize());
if (m_digestSize % 2 > 0 || m_digestSize < 4 || m_digestSize > 16)
throw InvalidArgument(AlgorithmName() + ": DigestSize must be 4, 6, 8, 10, 12, 14, or 16");
m_buffer.Grow(2*REQUIRED_BLOCKSIZE);
m_L = 8;
}
示例7: MakeParameters
void Base64Encoder::IsolatedInitialize(const NameValuePairs ¶meters)
{
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)));
}
示例8: BenchMarkByName2
void BenchMarkByName2(const char *factoryName, size_t keyLength = 0, const char *displayName=NULLPTR, const NameValuePairs ¶ms = g_nullNameValuePairs)
{
std::string name(factoryName ? factoryName : "");
member_ptr<T_FactoryOutput> obj(ObjectFactoryRegistry<T_FactoryOutput>::Registry().CreateObject(name.c_str()));
if (!keyLength)
keyLength = obj->DefaultKeyLength();
if (displayName)
name = displayName;
else if (keyLength)
name += " (" + IntToString(keyLength * 8) + "-bit key)";
const int blockSize = params.GetIntValueWithDefault(Name::BlockSize(), 0);
obj->SetKey(defaultKey, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, blockSize ? blockSize : obj->IVSize()), false)));
BenchMark(name.c_str(), *static_cast<T_Interface *>(obj.get()), g_allocatedTime);
BenchMarkKeying(*obj, keyLength, CombinedNameValuePairs(params, MakeParameters(Name::IV(), ConstByteArrayParameter(defaultKey, blockSize ? blockSize : obj->IVSize()), false)));
}
示例9: ka
void SAFER::Base::UncheckedSetKey(const byte *userkey_1, unsigned int length, const NameValuePairs ¶ms)
{
bool strengthened = Strengthened();
unsigned int nof_rounds = params.GetIntValueWithDefault(Name::Rounds(), length == 8 ? (strengthened ? 8 : 6) : 10);
const byte *userkey_2 = length == 8 ? userkey_1 : userkey_1 + 8;
keySchedule.New(1 + BLOCKSIZE * (1 + 2 * nof_rounds));
unsigned int i, j;
byte *key = keySchedule;
SecByteBlock ka(BLOCKSIZE + 1), kb(BLOCKSIZE + 1);
if (MAX_ROUNDS < nof_rounds)
nof_rounds = MAX_ROUNDS;
*key++ = (unsigned char)nof_rounds;
ka[BLOCKSIZE] = 0;
kb[BLOCKSIZE] = 0;
for (j = 0; j < BLOCKSIZE; j++)
{
ka[BLOCKSIZE] ^= ka[j] = rotlFixed(userkey_1[j], 5U);
kb[BLOCKSIZE] ^= kb[j] = *key++ = userkey_2[j];
}
for (i = 1; i <= nof_rounds; i++)
{
for (j = 0; j < BLOCKSIZE + 1; j++)
{
ka[j] = rotlFixed(ka[j], 6U);
kb[j] = rotlFixed(kb[j], 6U);
}
for (j = 0; j < BLOCKSIZE; j++)
if (strengthened)
*key++ = (ka[(j + 2 * i - 1) % (BLOCKSIZE + 1)]
+ exp_tab[exp_tab[18 * i + j + 1]]) & 0xFF;
else
*key++ = (ka[j] + exp_tab[exp_tab[18 * i + j + 1]]) & 0xFF;
for (j = 0; j < BLOCKSIZE; j++)
if (strengthened)
*key++ = (kb[(j + 2 * i) % (BLOCKSIZE + 1)]
+ exp_tab[exp_tab[18 * i + j + 10]]) & 0xFF;
else
*key++ = (kb[j] + exp_tab[exp_tab[18 * i + j + 10]]) & 0xFF;
}
}
示例10: InvalidArgument
void RC2::Base::UncheckedSetKey(const byte *key, unsigned int keyLen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keyLen);
int effectiveLen = params.GetIntValueWithDefault(Name::EffectiveKeyLength(), DEFAULT_EFFECTIVE_KEYLENGTH);
if (effectiveLen > MAX_EFFECTIVE_KEYLENGTH)
throw InvalidArgument("RC2: effective key length parameter exceeds maximum");
static const unsigned char PITABLE[256] = {
217,120,249,196, 25,221,181,237, 40,233,253,121, 74,160,216,157,
198,126, 55,131, 43,118, 83,142, 98, 76,100,136, 68,139,251,162,
23,154, 89,245,135,179, 79, 19, 97, 69,109,141, 9,129,125, 50,
189,143, 64,235,134,183,123, 11,240,149, 33, 34, 92,107, 78,130,
84,214,101,147,206, 96,178, 28,115, 86,192, 20,167,140,241,220,
18,117,202, 31, 59,190,228,209, 66, 61,212, 48,163, 60,182, 38,
111,191, 14,218, 70,105, 7, 87, 39,242, 29,155,188,148, 67, 3,
248, 17,199,246,144,239, 62,231, 6,195,213, 47,200,102, 30,215,
8,232,234,222,128, 82,238,247,132,170,114,172, 53, 77,106, 42,
150, 26,210,113, 90, 21, 73,116, 75,159,208, 94, 4, 24,164,236,
194,224, 65,110, 15, 81,203,204, 36,145,175, 80,161,244,112, 57,
153,124, 58,133, 35,184,180,122,252, 2, 54, 91, 37, 85,151, 49,
45, 93,250,152,227,138,146,174, 5,223, 41, 16,103,108,186,201,
211, 0,230,207,225,158,168, 44, 99, 22, 1, 63, 88,226,137,169,
13, 56, 52, 27,171, 51,255,176,187, 72, 12, 95,185,177,205, 46,
197,243,219, 71,229,165,156,119, 10,166, 32,104,254,127,193,173};
SecByteBlock L(128);
memcpy(L, key, keyLen);
int i;
for (i=keyLen; i<128; i++)
L[i] = PITABLE[(L[i-1] + L[i-keyLen]) & 255];
unsigned int T8 = (effectiveLen+7) / 8;
byte TM = byte((int)255 >> ((8-(effectiveLen%8))%8));
L[128-T8] = PITABLE[L[128-T8] & TM];
for (i=127-T8; i>=0; i--)
L[i] = PITABLE[L[i+1] ^ L[i+T8]];
for (i=0; i<64; i++)
K[i] = L[2*i] + (L[2*i+1] << 8);
}
示例11: gamma
void SEAL_Policy<B>::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
{
m_insideCounter = m_outsideCounter = m_startCount = 0;
unsigned int L = params.GetIntValueWithDefault("NumberOfOutputBitsPerPositionIndex", 32*1024);
m_iterationsPerCount = L / 8192;
SEAL_Gamma gamma(key);
unsigned int i;
for (i=0; i<512; i++)
m_T[i] = gamma.Apply(i);
for (i=0; i<256; i++)
m_S[i] = gamma.Apply(0x1000+i);
m_R.New(4*(L/8192));
for (i=0; i<m_R.size(); i++)
m_R[i] = gamma.Apply(0x2000+i);
}
示例12: CipherSetKey
void ChaCha_Policy::CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length)
{
CRYPTOPP_UNUSED(params);
CRYPTOPP_ASSERT(length == 16 || length == 32);
m_rounds = params.GetIntValueWithDefault(Name::Rounds(), 20);
if (!(m_rounds == 8 || m_rounds == 12 || m_rounds == 20))
throw InvalidRounds(ChaCha::StaticAlgorithmName(), m_rounds);
// "expand 16-byte k" or "expand 32-byte k"
m_state[0] = 0x61707865;
m_state[1] = (length == 16) ? 0x3120646e : 0x3320646e;
m_state[2] = (length == 16) ? 0x79622d36 : 0x79622d32;
m_state[3] = 0x6b206574;
GetBlock<word32, LittleEndian> get1(key);
get1(m_state[4])(m_state[5])(m_state[6])(m_state[7]);
GetBlock<word32, LittleEndian> get2(key + ((length == 32) ? 16 : 0));
get2(m_state[8])(m_state[9])(m_state[10])(m_state[11]);
}
示例13: IsolatedInitialize
void ByteQueue::IsolatedInitialize(const NameValuePairs ¶meters)
{
m_nodeSize = parameters.GetIntValueWithDefault("NodeSize", 256);
Clear();
}
示例14: IsolatedInitialize
void HashFilter::IsolatedInitialize(const NameValuePairs ¶meters)
{
m_putMessage = parameters.GetValueWithDefault(Name::PutMessage(), false);
int s = parameters.GetIntValueWithDefault(Name::TruncatedDigestSize(), -1);
m_digestSize = s < 0 ? m_hashModule.DigestSize() : s;
}