News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

xor encryption

Started by ecube, December 15, 2006, 04:49:12 AM

Previous topic - Next topic

ecube

i'm using xor on ascii strings and that keys are all numbers, my question is how do make sure my key doesn't put characters in my ascii string that no longer makes it a valid string? Is there a certain number range I should use? Thanks

Tedd

Depends what character range you consider to be valid.
I would say it's any characters but zero (null-terminator) - so apart from xor-ing a character with itself, then they should all be fine (ensuring this is a different matter - keys cannot, therefore, contain characters the strings can.)
Alternatively you can say the range is only printable characters (roughly 32--127, plus tabs maybe) in which case your key range is going to be quite limited. Basically you limit yourself to keys having only particular bits set (bits 5--6 in this case - which is fairly useless.)
No snowflake in an avalanche feels responsible.

tofu-sensei

or use a caesar cipher such as rot13 which is equally insecure  :wink

hutch--

cube,

Have a look at the encryption algos in the masm32 library, whether they are XOR or rotates does not matter much but the real strength of these designs is if you bother to create good quality large random keys for them.

The general drift is if every key is unique and highly random, no-one will break the encryption. It gets weaker with re-use but still not an easy task for someone without high powered brute force techniques.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ecube

Hutch,
Yeah I believe I read somewhere you mentioning you can use entire files as keys :) thought that was pretty interesting, I ended up just using an rc4 implementation however, amazing how simple it is, yet how powerful :)