📄 fnacounter.cpp
字号:
/* Copyright 2001,2002,2003 NAH6 BV
* All Rights Reserved
*
* $Header: /var/lib/cvs/secphone/ui/rng/fortuna/fnaCounter.cpp,v 1.4 2003/11/21 16:12:58 itsme Exp $
*
*
* Design of the PRNG is literally taken from 'Practical Cryptography', by Niels Ferguson, and Bruce Schneier.
*
*/
#include "fnaCounter.h"
#include "vectorutils.h"
//--------------------------------------------------------------------------
//------------------counter handling----------------
void Counter::Clear()
{
m_value.clear();
m_value.resize(COUNTERSIZE);
}
void Counter::Increment()
{
for (ByteVector::iterator i= m_value.begin() ; i!=m_value.end() ; ++i)
{
if (++(*i))
break;
}
}
bool Counter::IsZero() const
{
for (ByteVector::const_iterator i= m_value.begin() ; i!=m_value.end() ; ++i)
{
if (*i)
return false;
}
return true;
}
const ByteVector& Counter::GetValue() const
{
return m_value;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -