3
$\begingroup$

I'm using ISAAC for encryption but only need an 8 bit number. So, if I use N mod 255, I presume the output would be only a random sequence of 255 numbers... but is it still secure?

I could of course copy the 8 bit number to be encrypted into the first 8 bits of a 32 bit number and then fill the rest of it with random numbers and then mod it with the 32 bit ISAAC output.

$\endgroup$

1 Answer 1

4
$\begingroup$

Well, let's start with that N mod 255 doesn't convert number to 8bit byte, but a byte without highest possible value, 255. You were looking for either N mod 256 or N and 255 (somewhat known assembly trick to do some divides faster).

Now, if your source is cryptographically sound, then any amount of bits cut from it will be sound (except might collide faster). However this isn't case when cutting a value that isn't power of 2! In your example, let's assume we are cutting 8-bit values (0-255) to your N mod 255 (0-254). In this case we will get 1-254 with same probability, but we are twice as likely to get 0, and we will never get 255. This obviously makes skew in your data, which is usually combated by cutting last values that would cause such skew (in my example, we would reject 255 and draw value again).

Of course all above holds in your specific case of ISAAC.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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