Fairness
Description

Description for variables found in provably fair codes


	$ss -> Server Seed
	$cs -> Client Seed
	$nn -> Nonce
Dice

Provably Fair code for Dice game - PHP Version


	function lucky_number($server_seed, $client_seed, $nonce){
		
		$result_seed = hash_hmac('sha512', $server_seed, $client_seed.':'.$nonce);
		$result_number = hexdec(substr($result_seed,0,10));
		$lucky_number = $result_number % 10000;
		
		return $lucky_number;
		
	}
HiLo

Provably Fair code for HiLo game - PHP Version


	function hilo($ss, $cs, $nn, $card_cursor){
		
		$seed = hash_hmac('sha512', $ss, $cs.':'.$nn.':'.$card_cursor);
		$seed = hexdec(substr($seed,0,8));
		$color_seed = hexdec(substr($seed,0,6));

		$card = [($seed % 13) + 1,($color_seed % 4) + 1];

		return $card;
		
	}
Mines

Provably Fair code for Mines game - PHP Version


function seedToMines(int $mines_no = 1){
		
    $mines = [];
    $i = 0;

    while(count($mines) < $mines_no){

        $seed = hash_hmac(
            'sha512', 
            $ss, 
            $cs.':'.$nn.':'.$i
        );

        $seed = strval(hexdec(substr($seed,0,10)));
        $mine_pos = abs(substr($seed,-4))%25;
        if($mine_pos != 0 && !in_array($mine_pos, $mines)){
            $mines[] = $mine_pos;
        }
        $i++;
    }

    return $mines;
    
}
Towers

Provably Fair code for Towers game - PHP Version


function seedToTowers(int $risk = 1){
		
    $bloks_data    = [];

    $elements   = 8 * $risk;
    $divider 	= 4;

    $n 			= 0;
    $row 		= 1;
    $i 	        = 0;
    
    while($i < $elements){
        $seed	    = hash_hmac(
            'sha512',
            $ss, 
            $cs.'-'.$nn.'-'.$n
        );
        $seed_to_n 	= hexdec(substr($seed,0,10));
        $number 	= abs(substr($seed,-4))%$divider;

        if(!isset($bloks_data[$row])){
            $bloks_data[$row] = [];
        }

        if(!in_array($number, $bloks_data[$row])){

            $bloks_data[$row][] = $number;

            if(sizeof($bloks_data[$row]) == $risk && $i != $elements){
                $row++;
            }

            $i++;
            
        }

        $n++;
    }

    return $bloks_data;
}
Plinko

Provably Fair code for Plinko game - PHP Version


function seedToPath(){
    $path = [];
        
    $seed = hash_hmac(
        'sha512', 
        $this->seeds[1].':'.$this->seeds[2], 
        $this->seeds[0]
    );

    $chars  = str_split($seed, 2);
    $l      = sizeof($chars);

    for ($i=0; $i<$l; $i+=4) {
        $num = hexdec($chars[$i])/pow(256, 1) + hexdec($chars[$i+1])/pow(256, 2) + hexdec($chars[$i+2])/pow(256, 3) + hexdec($chars[$i+3])/pow(256, 4);
        if($num < 0.5){
            $path[] = 0;
        } else {
            $path[] = 1;
        }
    }
    
    return $path;

}
Keno

Provably Fair code for Keno game - PHP Version


function seedToKenoNumbers(){
		
    $numbers = [];
    $n = 0;
    while(count($numbers) <= 19){
        $seed = hash_hmac(
            'sha512',
            $ss,
            $cs.':'.$nn.':'.$n);
        $seed = hexdec(substr($seed,0,10));
        $number = abs(substr(strval($seed),-4))%80;

        if(!in_array($number, $numbers)){
            $numbers[] = $number;
        }

        $n++;
    }

    return $numbers;
        
}

Bees

Provably Fair code for Bees game - PHP Version


function seedToMoney(int $nonce = null){

    $money_no = $this->maxSelects();
    $money = [];
    $i = 0;

    while(count($money) < $money_no){

        $seed = hash_hmac(
            'sha512', 
            $ss, 
            $cs.':'.$nn.':'.$i
        );

        $seed = strval(hexdec(substr($seed,0,10)));
        $mine_pos = abs(substr($seed,-4)) % ($this->honeycombs[$this->payout] + 1);
        if($mine_pos != 0 && !in_array($mine_pos, $money)){
            $money[] = $mine_pos;
        }
        $i++;
    }

    return $money;
    
}
Lottery

Provably Fair code for Lottery game - PHP Version


function numbersFromSeed($ss, $last_round_id){
	
	$numbers = [];
	$n = 0;
	while(count($numbers) != 5){
		$seed = hash_hmac(
			'sha512',
			$ss,
			'MegaPlayLottery-'.$last_round_id.':'.$n);
		$seed = hexdec(substr($seed,0,10));
		$number = abs(substr(strval($seed),-4))%36 + 1;

		if(!in_array($number, $numbers)){
			$numbers[] = $number;
		}

		$n++;
	}

	$seed = hash_hmac('sha512',	$ss,'MegaPlayJackpot-'.$last_round_id);
	$seed = hexdec(substr($seed,0,10));
	$jackpot = abs(substr(strval($seed),-4))%10 + 1;

	return [
		'lucky_numbers' => $numbers,
		'jackpot' => $jackpot
	];
			
}
Limbo

Provably Fair code for Limbo game - PHP Version


function seedToPayout(){
            
    $seed = hash_hmac(
        'sha512', 
        $this->seeds[0], 
        $this->seeds[1].':'.$this->seeds[2]
    );

    $seed = substr($seed, 0, 52 / 4);
    $number = hexdec($seed) / pow(2, 52);
    $multiplier = floor(95 / (1 - $number)) / 100;

    return max(1, min($multiplier, 1000000));

}
Crash

Provably Fair code for Crash game - JavaScript Version


function crashPointFromHash(serverSeed) {
	const hash = crypto
		.createHmac("sha256", serverSeed)
		.update(client_seed)
		.digest("hex");

	const hs = parseInt(100 / 5);
	if (divisible(hash, hs)) {
		return 1;
	}

	const h = parseInt(hash.slice(0, 52 / 4), 16);
	const e = Math.pow(2, 52);

	return Math.floor((100 * e - h) / (e - h)) / 100.0;
}
Roulette

Provably Fair code for Roulette game - PHP Version


  $seed = hash_hmac('sha512', $ss, $cs.':'.$nn);
  $seed = hexdec(substr($seed,0,10));
  $roulette_number = $seed % 37;
  
  return $roulette_number;

Hi Offline User
We are here to help you :D

Find your answer now


Send us a message