Last active
September 2, 2018 12:02
-
-
Save jjhesk/143a20bc66ea8e39030ff0d41c661b87 to your computer and use it in GitHub Desktop.
The original raffle odd calculation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func main(){ | |
| original_hash = "____________" | |
| var i int32 = 0 | |
| var c int32 = 0 | |
| var hit = false | |
| var np = u.totalOutcomeN | |
| mines := make([]int32, np) | |
| var target = int32(u.basicBet.Direction) | |
| var minesTarget = int32(u.basicBet.Target) % u.totalOutcomeN | |
| var betsize = u.basicBet.BetSize | |
| serverhash := xhashes.SHA512(original_hash) | |
| in := xhashes.SHA512(serverhash + "::" + u.basicBet.ClientHash + "::" + strconv.Itoa(u.basicBet.Nonce)) | |
| for c < minesTarget { | |
| v := i % int32(len(in)) | |
| lpf := int32(in[v])<<5 | int32(in[v])<<7 | int32(in[v])<<11 | int32(in[v])<<13 | int32(in[v])<<17 | int32(in[v])<<19 | |
| egv := (lpf + i) % np | |
| bchLee, _ := in_array(egv, mines) | |
| if (bchLee) { | |
| i++ | |
| continue | |
| } else { | |
| mines[c] = egv | |
| i++ | |
| c++ | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment