Author

Topic: Best/easiest way to generate a private key with XX sided dice. 16? 60? (Read 203 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
Do you know how would I record mouse movements and/or how could I could use that as an entropy source? I know bitaddress uses this method but then at the same time idk if it's using JavaScript cryptography, which isn't secure enough for a Bitcoin private key IMO.

I don't know how bitaddress and random library works exactly, but the short version is :
1. User move their mouse
2. You record mouse pointer position every time position change or/and every few milisecond
3. Stop when you get enough list of mouse pointer position
4. Feed the list into function, such as Linear congruential generator or Linear-feedback shift register (both of them are unsecure, but shouldn't be too hard to understand)
You could write your own function, but most likely it will be very insecure.

You could simply use /dev/random of a unix system.
The linux kernel uses mouse movements, inter-keyboard timings, CPU interrupts and other non-deterministic events to gather entropy.

That's definitely random enough to generate a private key.
Awesome! I'll test that out. Man I wish I asked a few years ago. Would have saved me approx 749283700 dice rolls. Grin. Thanks!

/dev/urandom also exist & commonly used rather than /dev/random, check https://unix.stackexchange.com/q/324209 for more info
hero member
Activity: 1220
Merit: 612
OGRaccoon
While dice is a fantastic way to do things I would look for another way to generate the addresses other that bitaddress.
While some will say it's ok to use I still think if your going to go the route of dice then you might aswell generate the addresses on your own too.

This has been used in the past it uses (CSPRNG) in your browser as its source of entropy instead of rolling physical dice.

https://github.com/grempe/diceware
legendary
Activity: 1382
Merit: 1122

Haha I'll see if I can wrap my head around this, but if not at least I can check the sources. Thanks!


Javascript itself is just a language. This doesn't say anything about the way the entropy is collected and the quality of the PRNG at all.


I was referring to a talk by... Who was it... Greg Maxwell? I think it was referring to blockchain.info or other websites and how they gather entropy using a poor method. I just don't use any other entropy source (for cold storage anyway) since idk how they work and therefore can't trust them. It's a huge problem being super paranoid but not having coding skills!


You could simply use /dev/random of a unix system.
The linux kernel uses mouse movements, inter-keyboard timings, CPU interrupts and other non-deterministic events to gather entropy.

That's definitely random enough to generate a private key.


Awesome! I'll test that out. Man I wish I asked a few years ago. Would have saved me approx 749283700 dice rolls. Grin. Thanks!
legendary
Activity: 1624
Merit: 2481
Do you know where I can read up on entropy? I'm not sure what that means or how to calculate it.

https://en.wikipedia.org/wiki/Entropy_(computing)


I know bitaddress uses this method but then at the same time idk if it's using JavaScript cryptography, which isn't secure enough for a Bitcoin private key IMO.

Do you know how would I record mouse movements and/or how could I could use that as an entropy source? Javascript itself is just a language. This doesn't say anything about the way the entropy is collected and the quality of the PRNG at all.

You could simply use /dev/random of a unix system.
The linux kernel uses mouse movements, inter-keyboard timings, CPU interrupts and other non-deterministic events to gather entropy.

That's definitely random enough to generate a private key.
legendary
Activity: 1382
Merit: 1122
You can't randomly generate a base-58 WIF private key directly because some of the bits contain non-random data. So you are going to have to generate a random 256-bit value and convert the result to a private key. Also, keep in mind that not all 256-bit values are valid private keys.

Basically, the number of N-sided dice you must roll to get 256 bits of entropy is 177.446 / ln N.

Do you know where I can read up on entropy? I'm not sure what that means or how to calculate it.

Any other simple/quick entropy sources would be welcomed as well. I'm just trying to save myself some time when generating private keys for cold storage and I don't trust other entropy sources since idk where they get it from or how it works. Thanks!

How about mouse movement? I seriously doubt it can be "recreated" easily since there are many factors from mouse type, DPI, mousepad surface, user's mood & many more.

The only problem is understanding library which used to generate entropy & you generate it while you're visiting website which track user's mouse movement.

Do you know how would I record mouse movements and/or how could I could use that as an entropy source? I know bitaddress uses this method but then at the same time idk if it's using JavaScript cryptography, which isn't secure enough for a Bitcoin private key IMO.

legendary
Activity: 4466
Merit: 3391
I've been thinking about grabbing some 16 sided dice, rolling them 64 times, converting the rolls to hex then punching that into bitaddress.org or segwitaddress.org.

I was trying to think of a way to avoid that step and was looking at 58 and 60 sided dice. Of course 58 sided dice aren't fair (different shapes/sizes) so I wouldn't go with that, but 60 may be an option. I could just reroll if I rolled a 59 or 60.

This leaves me with one issue. Is that even going to help me generate a private key? It would have to go through some checks so it's in the right format, so would it be worth buying such a random die, or would getting hex dice and converting that make more sense?

Side note, is it "more random" to flip a coin 256x, roll a 6-sided die 99x or roll a 16-sided die 64x? If you know of where I can read up on probability/entropy please let me know. I'd rather learn it for myself so I really understand it. Any other simple/quick entropy sources would be welcomed as well. I'm just trying to save myself some time when generating private keys for cold storage and I don't trust other entropy sources since idk where they get it from or how it works. Thanks!

You can't randomly generate a base-58 WIF private key directly because some of the bits contain non-random data. So you are going to have to generate a random 256-bit value and convert the result to a private key. Also, keep in mind that not all 256-bit values are valid private keys.

Basically, the number of N-sided dice you must roll to get 256 bits of entropy is 177.446 / ln N.
legendary
Activity: 1382
Merit: 1122
I've been thinking about grabbing some 16 sided dice, rolling them 64 times, converting the rolls to hex then punching that into bitaddress.org or segwitaddress.org.

I was trying to think of a way to avoid that step and was looking at 58 and 60 sided dice. Of course 58 sided dice aren't fair (different shapes/sizes) so I wouldn't go with that, but 60 may be an option. I could just reroll if I rolled a 59 or 60.

This leaves me with one issue. Is that even going to help me generate a private key? It would have to go through some checks so it's in the right format, so would it be worth buying such a random die, or would getting hex dice and converting that make more sense?

Side note, is it "more random" to flip a coin 256x, roll a 6-sided die 99x or roll a 16-sided die 64x? If you know of where I can read up on probability/entropy please let me know. I'd rather learn it for myself so I really understand it. Any other simple/quick entropy sources would be welcomed as well. I'm just trying to save myself some time when generating private keys for cold storage and I don't trust other entropy sources since idk where they get it from or how it works. Thanks!
Jump to: