106
General Discussion / Re: How to best perform an after-the-fact, unknown time sharedrop.
« on: August 19, 2015, 06:33:51 pm »
How about a random sharedrop date based on 1 minute of text captured during a public mumble session? This could be independently verified by a few of us. I included some directions below.
Code: [Select]
/* <- ignore, this is a JavaScript comment
*
* Paste the text including "cat" to "done" into a Unix shell. You should get the same hash below.
*
cat <<-done | sha1sum
<replace with 1 minute of mumble comments from a public session>
done
d062f0e592f0f8286dc2da3eeba2dff2ee1d604d -
*/
/*
* You can copy paste this entire script (comments are optional) into `node` to
* get a share drop date.. You can do the same thing live using any JavaScript
* runner. I created a very fast quick and dirty runner here:
* http://javascript-runner.blogspot.com/
*/
var begin_date = new Date("Wed Aug 19 2015 13:00:08 GMT-0500 (CDT)")
var end_date = new Date("Wed Dec 19 2015 13:00:08 GMT-0500 (CDT)")
var hash = "d062f0e592f0f8286dc2da3eeba2dff2ee1d604d"
var random_seed = parseInt(hash.substring(0,4), 16)
var random_max = Math.pow(2, 16)
// random_multiplier is a decimal number between 0 and 1 (or very close)
// For example: 0xFFFF / Math.pow(2, 16) == 0.9999847412109375
var random_multiplier = random_seed / random_max
var offset = end_date.getTime() - begin_date.getTime()
offset *= random_multiplier
var share_drop_date = new Date(begin_date.getTime() + offset)
var output = {
//random_max: random_max,random_seed: random_seed,random_multiplier,
share_drop_date: share_drop_date
}
console.log(output)
JSON.stringify(output)
// Given a begin date: "Wed Aug 19 2015 13:00:08 GMT-0500 (CDT)"
// An end date: "Wed Dec 19 2015 13:00:08 GMT-0500 (CDT)"
// And a chat log hash of d062f0e592f0f8286dc2da3eeba2dff2ee1d604d
// You should get {"share_drop_date":"2015-11-27T01:22:50.304Z"}