# Slot Machine (Encrypted)

## Introduction

This page explains how a particular slot machine works that is based on the encrypted fair gaming process. Ultimately, the result of all slot machines are based on a draw of random numbers. In the case of encrypted games, the random numbers are based on a long string of random characters.

## Provably Fair Casinos

Name Wizards Seal US-VA Friendly Play
CryptoSlots Casino
3.9
Yes Yes
Name:
Wizards Seal: Yes
US-VA Friendly: Yes
Play:

## Analysis

In the case of the the slot machine played at Crypto.Games, the slot machine is quite simple. It is a five-reel one-line game. The player must bet 10 credits. How much 10 credits are worth is determined by the player. Each reel has eight different symbols: apple, banana, cherry, grapes, strawberry, orange, Bitcoin, and peach. The outcome of each reel is independent of the other reels.

The following is the pay table for the Crypto.Games slot machine. The position of symbols never matters. For example, if the player gets two Bitcoin symbols, he will be paid regardless of where they are on the pay-line. All wins are on a "for one" basis. In the case of four of the same fruit and one bitcoin, I presume the player is paid for only the higher win of four of a kind, although the help file for the game doesn't address this situation.

### Pay Table

Event Pays
Five bitcoin 10000
Five of a kind 1500
Four bitcoin 700
Four of a kind 100
Three bitcoin 70
Two bitcoin 25
One bitcoin 11

## Game Analysis

I think the way the Crypto.Games slot machine was intended to work, each symbol would have an equal weighting, or chance. If this were true, then the following table shows my analysis. The return column is (win)*(probability)/10. The reason for dividing by 10 is the player must bet ten credits. The lower right cell shows a return of 98.03%.

### Return Table — Equal Weighting

Event Pays Combinations Probability Return
Five bitcoin 10,000 1 0.000031 0.030518
Five of a kind 1,500 7 0.000214 0.032043
Four bitcoin 700 35 0.001068 0.074768
Four of a kind 100 245 0.007477 0.074768
Three bitcoin 70 490 0.014954 0.104675
Two bitcoin 25 3,430 0.104675 0.261688
One bitcoin 11 11,970 0.365295 0.401825
Loser - 16,590 0.506287 0.000000
Total   32,768 1.000000 0.980286

However, the way the Fair Gaming process works, some symbols are more heavily weighted than others. To be specific, the apple, banana, cherry, grapes, and strawberry each have weights of 26, while the orange, Bitcoin, and peach have weights of 25. The probability of a reel stopping on any given symbol is proportional to its weight. Much of the return of the game comes from Bitcoin symbols. Since the weighting of a Bitcoin is 25 and the overall average is 25.625, there is a slightly less than 1 in 8 chance a reel will stop on a Bitcoin. This depresses the return of the game, as shown in the following table. The lower right cell shows a return of 95.06%.

### Return Table — Unequal Weighting

Event Pays Combinations Probability Return
Five bitcoin 10,000 9,765,625 0.000027 0.026973
Five of a kind 1,500 78,938,130 0.000218 0.032705
Four bitcoin 700 351,562,500 0.000971 0.067972
Four of a kind 100 2,748,092,600 0.007590 0.075904
Three bitcoin 70 5,062,500,000 0.013983 0.097880
Two bitcoin 25 36,450,000,000 0.100677 0.251691
One bitcoin 11 130,836,733,750 0.361377 0.397515
Loser - 186,513,035,520 0.515157 0.000000
Total   362,050,628,125 1.000000 0.950639

## Fair Gaming

Following is the process Crypto.Games uses to determine where each reel stops. This assumes the reader knows the basics of Hashing and base-16 math. If not, I go over that in my page on Dice (Encrypted Version).

1. Join the Server Seed and Client Seed together, Server Seed first.
2. Take the SHA-512 Hash of step 1.
3. Starting on the left side, take two characters from the Hash from step 2.
4. Convert the two characters from step 3 from hexadecimal to decimal.
5. Take the terminal digit of the result of step 4.
6. If the outcome of step 5 is 1 to 8, then map it to a symbol, as follows:
• 1 = Apple
• 2 = Banana
• 3 = Cherry
• 4 = Grapes
• 5 = Strawberry
• 6 = Orange
• 7 = Bitcoin
• 8 = Peach
7. If step 6 was in the 1 to 8 range, then assign that symbol to a reel, starting with the left.
8. Whether a symbols was found or not, advance two positions in the Hash and return to step 3, until five numbers in the 1 to 8 range are found (one for each reel).

## Example

Following is how the process works for an example hand.

In the image above from the Provably Fair panel, I chose my own Client Seed. Then I copy and paste elsewhere the Server Seed and the Hash of the Client Seed, they the label the "Next server seed SHA256." In this case, they are:

```Client seed:  sdf96dsf9876s9dd78f6

Next Server Seed Hash: bdfa300164ebbd77ce9a3c3c58863688c4537df91173088915afdd4c9b6b302c
```

I made a bet and played. My result, from left to right, was cherry-apple-banana-strawberry-banana, which lost.

I go back to the Provably Fair panel to ensure the result was predestined, once I chose my Client Seed. Here are the steps I take:

1. First I note the Last Server Seed, which they say was:
`ylVWazQHJxoG9TAcLmDj1n6q1UkJgyFW4oTJhUhL`

I put that through a SHA-256 Hashing program. The Hash of that seed is:

`bdfa300164ebbd77ce9a3c3c58863688c4537df91173088915afdd4c9b6b302c`

This matches the Next Server Seed Hash I was given before I made the bet, so I can feel confident the outcome was predestined after I chose a Client Seed, but before making a bet.

However, what I want to know why the outcome was cherry-apple-banana-strawberry-banana. Here is how to verify that:

1. Combine the Server Seed and Client Seed, in that order, to get ylVWazQHJxoG9TAcLmDj1n6q1UkJgyFW4oTJhUhLsdf96dsf9876s9dd78f6.
2. Take the SHA-512 Hash of step 1 to get 3F8CEF835C55B60C8682C580C1A0C6DCA5013F4614A82A6797273495CCE46418EA044CCD964B83D0765C9CE6A174F93E20DB56E118CF8AE82B2D0864FC09B066.
3. Take the first two characters, 3F, and convert them from hexadecimal to decimal: 3*16 + 15 = 48 + 15 = 63.
4. Take the last digit of 63, which is 3. Since that is in the range of 1 to 8, map it to a symbol per the Fair Gaming instructions above. In this case, a 3 maps to a Cherry.
5. Advance two symbols in the Hash from step 2, which are 8C.
6. Convert 8C from hexadecimal to decimal: 8*16 + 12 = 140.
7. The last digit of 140 is 0, which does not map to anything, so skip the 8C.
8. Advance two symbols in the Hash from step 2, which are EF.
9. Convert EF from hexadecimal to decimal: 14*16 + 15 = 239.
10. The last digit of 239 is 9, which does not map to anything, so skip the EF.
11. Advance two symbols in the Hash from step 2, which are 83.
12. Convert EF from hexadecimal to decimal: 8*16 + 3 = 131.
13. Take the last digit of 131, which is 1. Since 1 is in the range of 1 to 8, map it to a symbol per the Fair Gaming instructions above. In this case, a 1 maps to an Apple.
14. Advance two symbols in the Hash from step 2, which are 5C.
15. Convert 5C from hexadecimal to decimal: 5*16 + 12 = 92.
16. Take the last digit of 92, which is 2. Since 2 is in the range of 1 to 8, map it to a symbol per the Fair Gaming instructions above. In this case, a 2 maps to a Banana.
17. Advance two symbols in the Hash from step 2, which are 55.
18. Convert 55 from hexadecimal to decimal: 5*16 + 5 = 85.
19. Take the last digit of 85, which is 5. Since 5 is in the range of 1 to 8, map it to a symbol per the Fair Gaming instructions above. In this case, a 5 maps to a Strawberry.
20. Advance two symbols in the Hash from step 2, which are B6.
21. Convert B6 from hexadecimal to decimal: 11*16 + 6 = 182.
22. Take the last digit of 182, which is 2. Since 2 is in the range of 1 to 8, map it to a symbol per the Fair Gaming instructions above. In this case, a 2 maps to a Banana.
23. Five symbols have been found, so a cherry, apple, banana, strawberry, and banana are shown to the player on the center payline as the outcome of his bet.

## Fair Gaming Code

If all that sounds like a lot of steps to go through, then I would agree. For that reason, I conveniently wrote a PHP program to do it for you. Just click that link and follow these instructions:

• Enter the Server Seed on line 4.
• Enter the Client Seed on line 5.
• Enter the Next Server Seed Hash on line 6.
• Click "execute."

The verification of the Server Seed and outcome of the bet will be displayed in the Results box below.

I also maintain a copy of the code, which you may see by clicking the spoiler button below.

```       // Slot machine conversion for Crypto.Games

\$server_seed = "ylVWazQHJxoG9TAcLmDj1n6q1UkJgyFW4oTJhUhL";
\$client_seed = "sdf96dsf9876s9dd78f6";
\$next_server_seed_hash = "bdfa300164ebbd77ce9a3c3c58863688c4537df91173088915afdd4c9b6b302c";
\$reel_strip_array=array("Error","Apple","Banana","Cherry","Grapes","Strawberry","Orange","Coin","Peach");
\$win_array=array(10000,1500,700,100,70,25,11,0);
\$server_seed_hash=hash('sha256', \$server_seed);
if (\$server_seed_hash==\$next_server_seed_hash)
{ echo "Server Seed match.\n"; }
else
{
echo "SERVER SEED MISMATCH!\n";
echo "Server seed      =\t\$server_seed\n";
echo "Server seed Hash =\t\$server_seed_hash\n";
echo "Alleged next Hash=\t\$next_server_seed_hash\n";
}
\$reels_found=0;
\$position=0;
\$combined_seed = \$server_seed.\$client_seed;
echo "Combined seed = \$combined_seed\n";
\$combined_hash = hash('sha512', \$combined_seed);
echo "Hash of combined seed = \$combined_hash\n";
do
{
\$first_two=substr(\$combined_hash,\$position,2);
\$hex_to_dec=hexdec(\$first_two)%10;
if ((\$hex_to_dec>=1)&&(\$hex_to_dec<=8))
{
\$reels_array[\$reels_found] = \$hex_to_dec;
\$reels_found++;
echo "Reel \$reels_found =\t\$reel_strip_array[\$hex_to_dec]\n";
}
\$position+=2;
if (\$position==128)
{
echo "Error -- No more space in hash.\n";
\$reels_found=5;
}
}
while (\$reels_found<5);
\$coins=0;
for (\$i=0; \$i<=4; \$i++)
{
if (\$reels_array[\$i]==7)
{   \$coins++;   }
}
if (\$coins==5)
{   \$win=0; }
elseif ( (\$reels_array[0]==\$reels_array[1]) && (\$reels_array[0]==\$reels_array[2]) && (\$reels_array[0]==\$reels_array[3]) && (\$reels_array[0]==\$reels_array[4]))
{   \$win=1; } // five of a kind
elseif (\$coins==4)
{   \$win=2; }
elseif (((\$reels_array[0]==\$reels_array[1]) && (\$reels_array[0]==\$reels_array[2]) && (\$reels_array[0]==\$reels_array[3])) ||
((\$reels_array[0]==\$reels_array[1]) && (\$reels_array[0]==\$reels_array[2]) && (\$reels_array[0]==\$reels_array[4])) ||
((\$reels_array[0]==\$reels_array[1]) && (\$reels_array[0]==\$reels_array[3]) && (\$reels_array[0]==\$reels_array[4])) ||
((\$reels_array[0]==\$reels_array[2]) && (\$reels_array[0]==\$reels_array[3]) && (\$reels_array[0]==\$reels_array[4])) ||
((\$reels_array[1]==\$reels_array[2]) && (\$reels_array[1]==\$reels_array[3]) && (\$reels_array[1]==\$reels_array[4])))
{   \$win=3; } // four of a kind
elseif (\$coins==3)
{   \$win=4; }
elseif (\$coins==2)
{   \$win=5; }
elseif (\$coins==1)
{   \$win=6; }
else
{   \$win=7; }
echo "Win    =\t\$win_array[\$win]\n"

// Procedure
// 1.  Step the "position" to 0 and "reels found" to 0.
// 2.  Join server and client seed and server seed, in that order.
// 3.  Generate a SHA-512 hash of the string from step 2.
// 4.  Convert first two characters, starting at the "position" of the hash from step 3 from hexidecimal to decimal.
// 5.  Take the terminal digit from from 4.
// 6.  If the result from step 5 is 1 to 8, then, map it to a symbol, according to the table below, and increment "reels found" by 1.
// 7.  If five reels have been found, then stop, otherwise increment the "position" by 1 and go back to step 4.
// 8.  After five reels have been found, display them from left to right, in order that they were found in the Hash.
// 9.  Symbol map:
//     1 = Apple
//     2 = Banana
//     3 = Cherry
//     4 = Grapes
//     5 = Strawberry
//     6 = Orange
//     7 = Coin
//     8 = Peach
?>
```