[crypto] Add operators to sAesIvCtr

This commit is contained in:
jakcron 2018-04-21 17:17:54 +08:00
parent cdd11d58c6
commit f542b54154

View file

@ -78,10 +78,23 @@ namespace aes
memcpy(this->iv, iv, kAes128KeySize);
}
bool compare(const sAesIvCtr& other) const
{
return memcmp(this->iv, other.iv, kAesBlockSize) == 0;
}
void operator=(const sAesIvCtr& other)
{
set(other.iv);
}
bool operator==(const sAesIvCtr& other) const
{
return compare(other);
}
bool operator!=(const sAesIvCtr& other) const
{
return !compare(other);
}
};
#pragma pack (pop)