It is well-known that, doing a XOR of a file against a short key is highly insecure encryption (can be broken with frequency analysis).
But if the length of the key is equal to (or has same order of magnitude than) the length of the file to be encrypted, then the situation is close to a one-time-pad / Vernam cipher and it is secure (no frequency analysis can be done).
Is there a rule of thumb for which XOR cipher is generally considered as safe?
key size = file size=> super safe, one-time pad
key size = (1/2) file size=> looks really really safe, I don't see how a freq analysis could work with only 4 repetitions
key size = (1/100) file size=> ?
key size = (1/10000) file size=> ?
Let's say the file is 10 GB if it helps to get the order of magnitudes.
key size = (1/2) file size:
file: 0101 0111 (size 8) key: 0100 0100 (0100, i.e. size 4, repeated twice) cyphertext: 0001 0011
Here the key
0100 is repeated twice. How could someone having only the size-8 cyphertext and knowledge of the fact the key is of size 4 break it?