Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # poor-man's quantum photon detector randomizer
  4. # ~1kb/s
  5. # over a test of a thousand time, global entropy was equal to 7.99/8 and passed nearly all Dieharder tests, as well as FIPS 140-2
  6. # however, sigma, mean and chi-square stats aren't too much enthusiastic
  7. # overall, the result is pretty impressive, but of course, don't use it in production :)
  8.  
  9. DEVICE=/dev/video0
  10. # for external cameras should be /dev/video1
  11. FORMAT=image2pipe
  12. # fps-based image sequence from demuxer through pipe, format is automatically determined, as well as FPS and resolution
  13. # TODO force PNG format?
  14. TIMING=0.1
  15. # such timing is considered more or less practical for RNG based on my tests
  16.  
  17. while true
  18. do
  19. ffmpeg -i $DEVICE -f $FORMAT -t $TIMING - 2> /dev/null | sha512sum | cut -d ' ' -f 1
  20. done
  21.  
  22. # in the end when pressing Ctrl+C there will be repetitions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement