Tagged: 

This topic contains 5 replies, has 4 voices, and was last updated by  TheGrandRascal 5 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2102

    trees
    Member

    http://ubld.it/wp-content/uploads/2014/02/random_bitmap-300×225.png

    how does one generate such a bitmap from TrueRNG output?

    Also, would it be possible to create an audio file from this output
    &/OR
    to output it in real time as an audio stream?

    I tested with GPG key generation, it’s at least is 10 times faster with TrueRNG than without.

    Also, great product, fast shipping! And your support on these forums is absolutely ON POINT.
    So I’ll thank you extra for those who forgot to thank you in other threads for looking through source code to answer their questions! Thank you!

    What an amazing and dedicated team you have at ubld.it!

    #2103

    trees
    Member

    (OS: Debian)

    #2118

    Ubld.it Staff
    Moderator

    Sorry, I didn’t see this post until now.

    Creating bitmaps can be done in various ways. Most programs that will accept RAW you just import as a raw file and describe it to the program, such as 8 bit mono (would be 1 byte per pixel) or raw rgb would be 3 bytes per pixel (in rgb format).

    Photoshop, the gimp, these programs should work fine.

    For the easy button you can just use imagemagick which is available on most Linux platforms.

    First the image size; lets say we want a 640×480 image. Thats 640×480 bytes, now if we want it in rgb format, thats 640x480x3.

    So using your calculator (or bc on the commandline)

    you can do

    echo “640x480x3″ | bc
    The response is 921600

    So we need 921600 bytes to make a 640×480 image in rgb format.

    Capture using ‘dd’

    dd if=/dev/TrueRNG of=/tmp/image.raw bs=921600 count=1 iflag=fullblock

    (iflag=fullblock is important)

    This will capture 921600 bytes in the file /tmp/image.raw

    Now using ‘convert’ from imagemagick

    convert -depth 8 -interlace plane -size 640×480 rgb:/tmp/image.raw /tmp/image.jpg

    Now we have a 640×480 jpeg of random rgb values.

    ————–

    For audio you can do similar things like using the program audacity you can import the audio as raw, and specify how many channels and bit depth. Same as the image, if you wanted 16khz audio 2 channels, you need 16k*2 bytes per second of audio.

    You can also do funny things like catting /dev/TrueRNG to /dev/audio or piping it into sox or aplay to play the audio. Sox will accept raw input and convert to wav files based on your parameters.

    Hope this helps

    #2123

    trees
    Member

    Thanks very much for the comprehensive explanation. It should have occurred to me to try to import raw data into GIMP.

    I can’t post an image here but it worked great.

    here’s a different command I found which passes the random directly to an image.

    rawtoppm -rgb 512 512 < /dev/random| pnmtopng > random$(date +%Y%m%d%H%M%S).png

    #2145

    redneonglow
    Member

    To create a B&W image of the same size:

    rawtopgm 512 512 < /dev/random | pnmtopng > random.png

    #2231

    In Windows, GIF (and other) files are defined not only by their extensions but by certain leading and trailing bytes.

    Searching the web (“GIYF”)* for the correct bytes to add to the beginning and end of a filetype, adding those bytes where needed, and then changing the file’s extension, would be enough to created a picture file out of the raw data!

    Hope this helps…

    *(“GIYF”) = “Google Is Your Friend.” :)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.