Forums Register Login

Random stream cut off

+Pie Number of slices to send: Send
Hey all, I have designed a class, specifically designed for unix systems which dumps a specified number of bytes from the /dev/random block device to a specified binary file. Unfortunately I discovered that while java will read and copy 128 bytes of data, after that, the stream puts out zeros. IE: If I request a 256 byte file, it will give 128 bytes random data, and 128 bytes of zeroes.

Further complicating the matter is the fact that the exact same code, directed to the /dev/urandom device, performs flawlessly. I have checked the entropy pool, and there is more than enough entropy to fill the need. The presentation makes me think it is a limitation of the system, and not java, but I cannot find any reference to the problem online.

Any help would be greatly appreciated!
+Pie Number of slices to send: Send
Without seeing your code, I'm just guessing, but I'll bet that ReadDoesntDoWhatYouThinkItDoes

+Pie Number of slices to send: Send
 

Joe Ess wrote:Without seeing your code, I'm just guessing, but I'll bet that ReadDoesntDoWhatYouThinkItDoes



You nailed it exactly. I completely forgot /dev/random blocks on linux, and what that does to FileInputStream. If I could give karma, you would have it.

Mods, please close thread
Every plan is a little cooler if you have a blimp. And a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 977 times.
Similar Threads
BigInteger to byte array of size 8 bytes (Unsigned long) in Java
[SECURITY][SecureRandom] Problem!
InvalidKeyException in 3DES
servlet writes file that is sometimes corrupt
How to get out of 'OutOfMemoryError' ???
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:28:26.