Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I'm just looking at very simple encryption. I've noticed that the key is typically either at the front or at the back of the encrypted text. This is quite easy to break if you know the key. It can be made more difficult if the key is split up and scattered in random known positions within the encrypted message. The locations used by the key will only be known to the encrypter and decrypter.

Say the key is 0xBAADF00D and the message, after encryption is 20 bytes long. Say

0102030405060708090A0B0C0D0E0F1011121314

If the key is added, it will be 24 bytes. The encrypted code is shifted to make holes in positions 2, 9, 15 and 19.

0102 030405060708 090A0B0C0D 0E0F10 11121314

Then add key byte 1 at 15, key byte 2 at 9, 3 at 19 and 4 at 2 instead of the standard 1, 2, 3, 4 positions.

01020D030405060708AD090A0B0C0DBA0E0F10F011121314

On decryption, just extract the bytes from those positions, pack the remainder to obtain the key and the original encrypted message and begin the process of decryption.

Is there a name already given to this technique.

share|improve this question
    
What? There IS NO KEY IN THE CIPHERTEXT!!! Ever! –  user1028028 Apr 15 at 10:27
    
The name of that technique is "EXTREMELY BAD" –  user1028028 Apr 15 at 10:27
    
Ha ha - thanks for telling me it is a bad technique. –  cup Apr 15 at 10:37
    
The name of this technique is obfuscation –  Richie Frame Apr 15 at 10:43
    
What they said - this scheme is catastrophically weak! Read up on Kerchoffs Principal –  figlesquidge Apr 15 at 10:45
show 2 more comments

1 Answer 1

I don't know if it has a name, but I can tell you that it is a bad idea. A very bad one. The only thing I have to do to break the encryption is to try all the possible combinations of 4 bytes in the total 24 byte string. Intuition may tell some people that there are many combinations, but really? How many combinations are possible? The answer is 255024. This is 4 orders of magnitude smaller than the number of all the possible 4-byte keys, i.e. tens of thousands of times weaker than agreeing on a random key, instead of agreeing on the few positions where you are trying to hide it.

Conclusion: don't use this technique for anything serious.

share|improve this answer
    
The actual string is 1020 bytes long. I used 20 because it was easy to illustrate. It is for a fun project for encoding packets between machines. The key is different for every packet. –  cup Apr 15 at 11:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.