Jump to content

Verified RNG


Wesley

Recommended Posts

Does anyone know how I can generate a random number in some sort of verified way?

 

I am preparing for a project, and I would like it to be as open and verifiable as is possible, and the only part that I am missing is if someone were to claim that I chose to direct the output in some way. If it was able to be looked up/verified what my roll was, then it should be able to reduce or eliminate those concerns.

 

Any help would be appreciated.

 

Thanks in advance!

Link to comment
Share on other sites

That will be very difficult in the current political climate. Even if you could verify all your software and hardware, people can still have doubts. Your system can be breached or your hardware compromised. Promising verifiability will put people on edge and if you're targeting a crypto crowd, they're well aware of the dangers. Other than relying on reputation, I don't think there's much to do about distrust and accusations of number fiddling.

Link to comment
Share on other sites

It would be for drawing purposes. I have found http://www.random.org/draws/ which would be a third-party offering a drawing, which would add a lot to the credibility.

 

It is more for fun/ promotion than anything. I do not think anyone would complain, but I would want the verification just in case.

 

Here is a video to that service: http://www.random.org/guides/video1/

 

Fees start at $4.95, which I would cover. I would probably cover under $23, which I can't foresee getting over 3,000 entrants. I would pay for the third party if needed, but I am just wondering if another (cheaper) option is available to people who have used something like this in the past.

Link to comment
Share on other sites

Cheapest way would be to write your own software, but that comes with the cost of time, skills and server hosting fees. You can use your computer/s for hosting and rely on either pseudo-random number generation or random.org's web API. Later, you can always scale up from there by moving the service to a dedicated host and buying a hardware random number generator. This is as cheap as it gets in terms of money but it's not as trivial as having an online drawing service.

 

I reckon paying for random.org's service initially to gauge people's level of interest and making the cost-benefit from there on is a good way to start. You certainly won't have to commit many hours just to get your idea up and running. Alternatively, if you've got a skilled web-developer friend, s/he can probably set up the service in a day or so, but you won't have as much credibility. I'm not aware of any alternatives to the drawing service random.org offers, so I'll defer this part to others.

Link to comment
Share on other sites

  • 3 weeks later...

Hey, just saw this post and thought I'd offer an idea. I assume everyone has registered with your website, or that you have some way of assembling a file with the name of each entrant on a separate line. These names are combined with the name of the competition to create a list of hashes to be published.

 

The general principle could be implemented in a number of ways, but here I'll offer a quick solution in Python (either 2.7 or 3).

from hashlib import sha256hashes = []COMPETITION = b"Wesley's Wonderful Winners"with open('entrants.txt', 'rb') as f:    for line in f:        if not line: continue                to_hash = COMPETITION + line.strip()        entrant_hash = sha256(to_hash).hexdigest().encode('utf-8')        hashes.append(entrant_hash)hashes = sorted(hashes)with open('entrant_hashes.txt', 'wb') as f:    f.write(COMPETITION + b'n')    f.write(b'=' * len(COMPETITION) + b'nn')    for entrant_hash in hashes:        f.write(entrant_hash + b'n')

This reads in a file called "entrants.txt" and outputs "entrant_hashes.txt" which will look like ths following:

Wesley's Wonderful Winners==========================0f23540bd360c4caff2a521f39bd6b4c217634ea895a4454c78620b10cf38f2816db7cf51b5dbd4305feacff41c42526b109ac15d1e9287d9eb981014d620b4a7ee5bbc0defb83aa1ef61ae35644523daf2b1202156ccfbf5bf5642ae37455b8d080b46dff919c649f6d609946a1a04c007d50aa54ceaa3bbfafb0859e051132...

This is published before the draw, along with the method, so everyone can verify they are entered in the draw.

 

Now you need to have some public and unpredictable information, such as lottery numbers, newspaper headline, top page of reddit, weather information, i.e. something which everyone can agree on such that it's infeasible that anyone involved would influence it.

 

For instance, you could say that at 18:00 UTC you'll take the name of the top link on the front page of imgur. That is "Pastry folding 101" at the time of writing. You take a screenshot for proof, and anyone else online at that time can confirm.

 

That secret is then concatenated to the list of entrant hashes and the whole thing is hashed. That is converted into an index into the list of hashes and there's your winner!

 

Here's a script to do it for you:

from hashlib import sha256COMPETITION = b"Wesley's Wonderful Winners"OPEN_SECRET = b"Pastry folding 101"hashes = []entrant_dict = {}with open('entrants.txt', 'rb') as f:    for line in f:        if not line: continue                to_hash = COMPETITION + line.strip()        entrant_hash = sha256(to_hash).hexdigest().encode('utf-8')        entrant_dict[entrant_hash] = line        hashes.append(entrant_hash)hashes = sorted(hashes)hash_data = (COMPETITION + b'n' +                 b'=' * len(COMPETITION) + b'nn' +                b'n'.join(hashes)) # recreate entrant_hashes.txt in memory# perhaps need to make another that just reads the file of hashes# so everyone else can verify which hash was pickedto_hash = hash_data + OPEN_SECRETindex_hash = sha256(to_hash).hexdigest()winner_index = int(index_hash, 16) % len(hashes)winner_hash = hashes[winner_index]winner = entrant_dict[winner_hash]print("Winner is: {}".format(winner.decode()))

Hope this helps, or at least that someone finds it interesting!

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.