mirror of https://github.com/aria2/aria2
InternalARC4Encryptor: Fix compiler warning and remove no use ctor/dtor
parent
f2a1d241c2
commit
da278225c1
|
@ -37,11 +37,6 @@
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
ARC4Encryptor::~ARC4Encryptor()
|
|
||||||
{
|
|
||||||
for (auto& c : state_) c = 0;
|
|
||||||
i = j = 0;
|
|
||||||
}
|
|
||||||
void ARC4Encryptor::init(const unsigned char* key, size_t keyLength)
|
void ARC4Encryptor::init(const unsigned char* key, size_t keyLength)
|
||||||
{
|
{
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -60,7 +55,7 @@ void ARC4Encryptor::init(const unsigned char* key, size_t keyLength)
|
||||||
void ARC4Encryptor::encrypt(size_t len, unsigned char* out,
|
void ARC4Encryptor::encrypt(size_t len, unsigned char* out,
|
||||||
const unsigned char* in)
|
const unsigned char* in)
|
||||||
{
|
{
|
||||||
for (auto c = 0; c < len; ++c) {
|
for (auto c = 0u; c < len; ++c) {
|
||||||
i = (i + 1) & 0xff;
|
i = (i + 1) & 0xff;
|
||||||
j = (j + state_[i]) & 0xff;
|
j = (j + state_[i]) & 0xff;
|
||||||
auto sj = state_[i];
|
auto sj = state_[i];
|
||||||
|
|
|
@ -45,9 +45,6 @@ private:
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ARC4Encryptor() {}
|
|
||||||
~ARC4Encryptor();
|
|
||||||
|
|
||||||
void init(const unsigned char* key, size_t keyLength);
|
void init(const unsigned char* key, size_t keyLength);
|
||||||
|
|
||||||
// Encrypts data in in buffer to out buffer. in and out can be the
|
// Encrypts data in in buffer to out buffer. in and out can be the
|
||||||
|
|
Loading…
Reference in New Issue