K
is a 224-bit key.C
is a 32-bit counter; it is publicly known. the same value is never used twice.plaintext
has arbitrary length (up to 64kB).H
is a cryptographic hash function that returnslen(plaintext)
bits.^
is the bitwise XOR.+
is the concatenation.
Encryption:
ciphertext = plaintext ^ H(K + C)
Decryption:
plaintext = ciphertext ^ H(K + C)
- Are there any fundamental flaws?
- Would it make sense to use a longer key?
- Under what circumstances would doing
H(C + K + C)
instead ofH(K + C)
make the algorithm more secure? - I intend to use Skein, which comes in three flavors of internal state sizes: 256, 512 and 1024 bits. How does the internal state size limit the strength of the whole system? Would it make any sense to use the 512/1024 bit variants, even though
len(K+C) = 256
? - Is there anything particular about Skein that would make it unsuitable for the job?
edit: Thinking about it, len(K) > internal state size
seems pointless. To break the encryption, an attacker would just need to find a K
that produces the same internal state as the real K
.