3 ms·
I agree it's pretty meaningless as cheap TRNG's are a solved problem. Far as dice, one of my experiments in TRNG's was a shoe box full of dice. Shake it up, du
by nickpsecurity 8y ago
I agree it's pretty meaningless as cheap TRNG's are a solved problem.
Far as dice, one of my experiments in TRNG's was a shoe box full of dice. Shake it up, dump them, put the numbers into a computer program, whiten it, and tada. The first one used 8-sided die since each one maps cleanly to 3 bits (2 ^ 3 = 8). The next iteraiton used regular, 6-sided die just discarding any above four to map easily to 2 bits. Did something similar with a deck of cards after throughout shuffling.
Such methods were good for producing an initial secret that I'd use with algorithms like CPRNG's to produce the rest.
- zokier 8y ago> Did something similar with a deck of cards after throughout shuffling. I was under the impression that shuffled card deck is more difficult to convert to random number, you need something like Lehmer Code. Did you find some easy good shortcut here?
- nickpsecurity 8y agoIf you use 32 cards, it maps cleanly to 5-bits of entropy. You can keep the others in there to keep shuffling randomness of 52 cards. Just ignore them when entering numbers.
- klodolph 8y agoUsing 32 cards to get 5 bits of entropy only works if you are randomly selecting a single card at a time. If you shuffle a deck of 32 cards, you get ~117 bits, a fair bit less that the 160 bits you would get for 5 bits/card, and there's extra math.
- nickpsecurity 8y agoI shuffled a full deck multiple times, no less than five, before using cards in order ignoring any but the 32. I know shuffling all the cards adds randomness vs just shuffling 32. I do want to know why you say two things: 1. 32 = 117 bits of entropy, not 150, after lots of shuffling. 2. It works if I randomly select a single card at a time but not in order from a randomized deck. In order from a randomized deck should give the entropy amount or close to it. I'm not a probability expert. Just doing what I could with good, shuffling skills. Good enough that people refused to play Spades with decks I shuffled. So, I thought I had good entropy. I'm always up for improvements.
- klodolph 8y agoThe first card you draw can be any one of 32 cards. This gives you 5 bits of entropy. The second card can be any one of 31 cards, because it can't be the same as the first card. This gives you log2 31 = ~4.95 bits of entropy. If this argument isn’t convincing, think of it this way. If you draw two cards, then there are 32 choose 2 cards you can draw, and 32 choose 2 is 496, giving log2(496) = ~8.95 bits. You can draw them in two different orders, giving 1 extra bit, total of ~9.95. If you could draw a pair of the same card, there are 32 different pairs to draw, giving (496 * 2) + 32 possibilities, which is 1024, and log2 1024 = 10. But you can't draw a pair of the same card. Or for another argument, consider that there are 32! different ways to shuffle the deck with 32 cards. log2 32! = ~117.