1
0
mirror of https://github.com/biergaizi/codecrypt synced 2024-06-27 09:18:16 +00:00

cosmetic fixes

This commit is contained in:
Mirek Kratochvil 2014-03-28 08:33:44 +01:00
parent 9e5f5154b4
commit 6a8029e626
3 changed files with 10 additions and 5 deletions

@ -30,15 +30,13 @@ class arcfour : public streamcipher
inttype I, J;
inttype mask;
public:
bool init () {
void init () {
size_t Ssize = 1 << bits;
if (bits > 8 * sizeof (inttype) ) return false;
I = J = 0;
S.resize (Ssize);
mask = ~ (inttype) 0;
if ( (inttype) (1 << bits) ) mask %= 1 << bits;
for (size_t i = 0; i < Ssize; ++i) S[i] = i;
return true;
}
void clear() {
@ -97,6 +95,10 @@ public:
gen (n, & (out[0]) );
}
size_t key_size() {
return 256;
}
size_t block_size() {
return 1;
}

@ -60,7 +60,7 @@ class size64proc : public hash_proc
};
/*
* list of hash functions availabel
* list of hash functions available
*/
typedef map<string, hash_proc*> hashmap;

@ -26,11 +26,14 @@
class streamcipher
{
public:
virtual bool init() = 0;
virtual void init() = 0;
virtual void clear() = 0;
virtual void load_key (const byte*begin, const byte*end) = 0;
virtual byte gen() = 0;
virtual void gen (size_t n, byte*out) = 0;
//advisory values for effective usage
virtual size_t key_size() = 0;
virtual size_t block_size() = 0;
void discard (size_t n) {