This commit is contained in:
TLINDEN
2015-09-05 20:28:20 +02:00
parent 0f16de4127
commit 44e14d9465

View File

@@ -176,7 +176,7 @@ void keyhash(char *pw, byte *hash) {
/* diffuse and confuse hash */ /* diffuse and confuse hash */
for(round=0; round<K_HASH_ROUNDS; round++) { for(round=0; round<K_HASH_ROUNDS; round++) {
for(i=0; i<K_HASH_ROUNDS; i++) { for(i=0; i<K_HASH_ROUNDS; i++) {
hash[i] = iv ^ (rot8left(hash[i], 3) ^ kbox[rcon(iv)]); hash[i] = iv ^ ((rot8left(hash[i], 3) * kbox[rcon(iv)])) % 255;
iv = hash[i]; iv = hash[i];
} }
} }
@@ -201,11 +201,13 @@ void rotate(byte array[], int size, int amt) {
} }
void rotatekey(byte *key, byte feedback) { void rotatekey(byte *key, byte feedback) {
rotate(key, S_BOX_ROUNDS, 1);
int i; int i;
for(i=0; i<S_BOX_ROUNDS; i++) { byte f = key[0];
key[i] = kbox[key[i] ^ feedback];
} for (i = S_BOX_ROUNDS-1; i>1; i--)
key[i-1] = kbox[key[i] ^ feedback];
key[16] = kbox[f ^ feedback];
} }
/* actual stream cipher: /* actual stream cipher: