Remove redundant IsInitialized_ state from Arc4Crypt.
Chaos Ci / test (push) Successful in 3m5s
Chaos Ci / benchmark (push) Successful in 1m29s

This commit is contained in:
hashlag committed 2026-09-20 22:44:10 +03:00
1 parent 11834e9e91
commit eed5bb2649
1 file changed
+1 -5
+1 -5
View File
@@ -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>