Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Bcgamevip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//NULL

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complete

2 changes: 1 addition & 1 deletion baccarat.html
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ <h2 class="text-center pb-5">Results</h2>
amount: 10,
initHash: qs.hash,
salt:
"00000000000000000009c6d5d13f0bf616e9601ab9b7f2dce635492700aaa773",
"0000000000000000000301e2801a9a9598bfb114e574a91a887f2132f33047e6",
result: [],
},
computed: {},
Expand Down
235 changes: 235 additions & 0 deletions baccaratsingle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Baccarat Single Verify</title>
<link rel="stylesheet" href="./lib/main.css">
<link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.min.css">
<script src="./lib/react.production.min.js"></script>
<script src="./lib/react-dom.production.min.js"></script>
<script src="./lib/crypto-js.js"></script>
<script src="./lib/tools.js"></script>
<script src="./lib/hooks.js"></script>
<script src="./lib/babel.min.js"></script>
<style>
.cards-list {
margin-bottom: 12px;
display: flex;
align-items: center;
}
.cards-list .card {
margin-right: 20px;
}
.card.red {
color: #f00;
}
</style>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
let qs = tools.queryString();
let { useEffect, useMemo } = React;
const { useSetState } = hooks;
function useInputControl (initState) {
const [state, setState] = useSetState(initState);
const bind = key => ({
value: state[key],
onChange: v => setState({[key]: v})
});
return [
state,
setState,
bind
];
}
function Input ({value, onChange, ...others}) {
return (
<div class="form-group">
<input value={value}
onChange={e => onChange(e.target.value)}
class="form-control"
{...others}
/>
</div>
);
}

const allNums = [
161, 180, 199, 218, 162, 205, 181, 200, 219, 163, 182, 220, 201, 177, 196,
215, 170, 178, 221, 197, 216, 171, 179, 198, 172, 217, 193, 212, 167, 186,
194, 173, 213, 168, 187, 195, 214, 188, 169, 209, 164, 183, 202, 210, 189,
165, 184, 203, 211, 166, 204, 185,
];

function createCards (hash, times, cards, hashList) {
hashList.push(hash);
if (times <= 0) return
let h = hash;
allNums.forEach((c) => {
cards.push({card: c, hash: h});
h = h.substring(1) + h.charAt(0);
});

hash = String(CryptoJS.SHA256(hash));
times--;
createCards(hash, times, cards, hashList);
}

function create (hash, times) {
times = times || 2;
let cards = [];
let hashList = [];
createCards(hash, times, cards, hashList);
cards.sort(function (o1, o2) {
if (o1.hash < o2.hash) {
return -1;
} else if (o1.hash == o2.hash) {
return 0;
} else {
return 1;
}
})
return cards;
}

function canBankerGetCard (point, palyerPoint, thirdCardPoint) {
if(palyerPoint >= 8) return false;
if(point <= 2) return true;
else if(point === 3) {
return thirdCardPoint !=8 ;
} else if(point === 4) {
return [0, 1, 8, 9].indexOf(thirdCardPoint) < 0;
} else if(point === 5) {
return [0, 1, 2, 3, 8, 9].indexOf(thirdCardPoint) < 0;
} else if(point === 6) {
return [6, 7].indexOf(thirdCardPoint) >= 0;
}
return false;
}

function getPoint (list) {
const result = list.reduce((pre, item) => {
const currPoint = item.pointNum > 10 ? 10 : item.pointNum;
return pre + currPoint;
}, 0)
return result % 10;
}

function getRestlt (hash) {
let beginHash = String(tools.sha256(hash));
const resultList = create(beginHash);
return resultList.map((m) => m.card);
}

function createCardFram(card) {
const CARDS = " ,A,2,3,4,5,6,7,8,9,10,J,Q,K".split(",");
const SUITS = ["♠", "♥", "♣", "♦"];
let suitsIndex = (card & 240) / 16 - 10;
let suits = SUITS[suitsIndex];
let point = CARDS[card % 16];
let pointNum = card % 16;
let style = suitsIndex % 2 === 0 ? "black" : "red";
let classNames = ["cardbox", style];
return {
style,
suits,
point,
pointNum: pointNum > 10 ? 10 : pointNum
};
}

function encode(suit, point) {
return ((suit + 10) << 4) + point;
}

function BaccaratSingle () {
const [state, setState, bind] = useInputControl({
clientSeed: qs.c||'',
serverSeed: qs.s||'',
nonce: qs.n||''
});

const result = useMemo(() => {
const serverSeedHash = tools.sha256(state.serverSeed);
const resultArr = [state.clientSeed, state.nonce];
const hmacSha256Result = String(CryptoJS.HmacSHA256(resultArr.join(":"), state.serverSeed));
const resultList = getRestlt(hmacSha256Result);
const player = [createCardFram(resultList[0]), createCardFram(resultList[2])];
const banker = [createCardFram(resultList[1]), createCardFram(resultList[3])];
const palyerPoint = getPoint(player);
const bankerPoint = getPoint(banker);
const isPlayerGetCard = palyerPoint % 10 < 6;
const isBankerEnd = bankerPoint % 10 >= 8;
if(isPlayerGetCard && !isBankerEnd) {
player.push(new Card(resultList[4]));
}
const thirdCardPoint = player[2] ? getPoint([player[2]]) % 10 : -1;
const flag = canBankerGetCard(bankerPoint % 10, palyerPoint % 10, thirdCardPoint);
if(flag) banker.push(isPlayerGetCard ? createCardFram(resultList[5]) : createCardFram(resultList[4]));
const playerPointFinal = getPoint(player);
const bankerPointFinal = getPoint(banker);
return {
player,
banker,
playerPointFinal,
bankerPointFinal,
hmacSha256Result,

}
}, [state]);
const {player, banker, playerPointFinal, bankerPointFinal} = result;
return (
<div className="main">
<h1 className="text-center pb-5">Baccarat single verify</h1>
<hr />
<h2 class="text-center">Input</h2>
<form className="py-5">
<Input placeholder="Server Seed" {...bind('serverSeed')} />
<Input placeholder="Client Seed (Hashed)" {...bind('clientSeed')} />
<Input placeholder="Nonce" {...bind('nonce')} />
</form>
<h2 class="text-center">Output</h2>
<form className="py-5">
<Input placeholder="HmacSHA256(clientSeed, serverSeed)" readOnly value={result.hmacSha256Result} />
<h5 style={{marginTop: 20}}>Result</h5>
<div className="result-list">
<div className="player-cards">
<p>Player: {playerPointFinal % 10}</p>
<div className="cards-list">
{player.map((item, index) => {
const clname = "result-card-item" + (index+1);
return (
<div className={clname + " card " + item.style} key={item.pointNum + "-" + index}>
<div className="flower">{item.suits}</div>
<div className="point">{item.point}</div>
</div>
)
})}
</div>
</div>
<div className="banker-cards">
<p>Banker: {bankerPointFinal % 10}</p>
<div className="cards-list">
{banker.map((item, index) => {
const clname = "result-card-item" + (index+1);
return (
<div className={clname + " card " + item.style} key={item.pointNum + "-" + index}>
<div className="flower">{item.suits}</div>
<div className="point">{item.point}</div>
</div>
)
})}
</div>
</div>
</div>
</form>
</div>
);
}
ReactDOM.render(<BaccaratSingle />, document.getElementById("app"));
</script>
</body>
</html>
11 changes: 8 additions & 3 deletions crash.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ <h2 class="subtitle">Third party script used to verify games on crash game.</h2>
<hr>
<div class="container">
<p>We made the decision to update Crash using a salted hash as requested by our players in order to provide the most randomized and fair results possible after Bet <span class="has-text-info"># 2561902</span>. For further details, please visit <a target="_blank" href="https://bitcointalk.org/index.php?topic=5256606">https://bitcointalk.org/index.php?topic=5256606</a></p>
<p>We made the decision to update Crash using a salted hash as requested by our players in order to provide the most randomized and fair results possible after Bet <span class="has-text-info"># 5282960</span>. For further details, please visit <a target="_blank" href="https://bitcointalk.org/index.php?topic=5416694">https://bitcointalk.org/index.php?topic=5416694</a></p>
</div>
<hr>
<div class="container">
Expand All @@ -100,7 +101,7 @@ <h2 class="subtitle">Third party script used to verify games on crash game.</h2>
<div class="field">
<label class="label">Salt</label>
<p class="control has-icons-left">
<input class="input" type="text" id="game_salt_input" placeholder="Salt" value="0000000000000000000e3a66df611d6935b30632f352e4934c21059696117f28">
<input class="input" type="text" id="game_salt_input" placeholder="Salt" value="0000000000000000000301e2801a9a9598bfb114e574a91a887f2132f33047e6">
<span class="icon is-small is-left"><i class="fa fa-filter"></i></span>
</p>
</div>
Expand Down Expand Up @@ -216,8 +217,12 @@ <h2 class="subtitle">Third party script used to verify games on crash game.</h2>
}
};
var hash_url = window.location.search
if ((/nosalt/).test(hash_url)) {
const query = new URLSearchParams(location.search);
const version = query.get('v');
if (version === 'v1') {
$('#game_salt_input').val('');
} else if (version === 'v2') {
$('#game_salt_input').val('0000000000000000000301e2801a9a9598bfb114e574a91a887f2132f33047e6');
}
if ((/hash=/).test(hash_url)) {
var hash = hash_url.match(/hash=[0-9a-zA-z]+/)[0].replace(/hash=/, '');
Expand All @@ -236,4 +241,4 @@ <h2 class="subtitle">Third party script used to verify games on crash game.</h2>
</script>
</body>

</html>
</html>
Loading