Remove redundant IsInitialized_ state from Arc4Crypt.
This commit is contained in:
1 parent
11834e9e91
commit
eed5bb2649
1 file changed
+1
-5
@@ -15,7 +15,6 @@ class Arc4Crypt
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Arc4Crypt()
|
Arc4Crypt()
|
||||||
: IsInitialized_(false)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<typename InputIt>
|
template<typename InputIt>
|
||||||
@@ -46,11 +45,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Arc4Gen Gen_;
|
Arc4Gen Gen_;
|
||||||
bool IsInitialized_;
|
|
||||||
|
|
||||||
void EnsureInitialized() const
|
void EnsureInitialized() const
|
||||||
{
|
{
|
||||||
if (!IsInitialized_)
|
if (!Gen_.IsInitialized())
|
||||||
{
|
{
|
||||||
throw Service::ChaosException("Arc4Crypt: not initialized");
|
throw Service::ChaosException("Arc4Crypt: not initialized");
|
||||||
}
|
}
|
||||||
@@ -59,9 +57,7 @@ private:
|
|||||||
template<typename InputIt>
|
template<typename InputIt>
|
||||||
void RekeyImpl(InputIt keyBegin, InputIt keyEnd)
|
void RekeyImpl(InputIt keyBegin, InputIt keyEnd)
|
||||||
{
|
{
|
||||||
IsInitialized_ = false;
|
|
||||||
Gen_.Rekey(keyBegin, keyEnd);
|
Gen_.Rekey(keyBegin, keyEnd);
|
||||||
IsInitialized_ = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename OutputIt, typename InputIt>
|
template<typename OutputIt, typename InputIt>
|
||||||
|
|||||||
Reference in new issue
Block a user