gpt4 book ai didi

How is the following Cryptographic Predictability happening?(以下加密可预测性是如何实现的?)

转载 作者:bug小助手 更新时间:2023-10-28 11:08:31 26 4
gpt4 key购买 nike



This is the scenario:

这是一个场景:


Server Key (always 40 chars)
Player1 Key (usually 20 chars) (selected as the first player in the current game)
Player2 Key (usually 20 chars) (selected as the second player in the current game)
Player3 Key (usually 20 chars) (selected as the third player in the current game)
After a plain text-join, an SHA-512 is returned. The first 13 digits of this SHA-512 are converted to Decimal (from Hex). That Decimal is passed through a function roughly as follows:

服务器键(通常为40个字符)Player1键(通常为20个字符)(选择为当前游戏的第一个玩家)Player2键(通常为20个字符)(选择为当前游戏的第二个玩家)Player3键(通常为20个字符)(选择为当前游戏的第三个玩家)纯文本-Join后,返回SHA-512。此SHA-512的前13位数字被转换为十进制(从十六进制)。该Decimal通过一个函数传递,大致如下:


function Transform(hash) {
let d = parseInt(hash, 16);
const e = Math.pow(2, 52);
let r = Math.floor((100 * e - d) / (e - d)) / 100.0
return r * 0.96
}

The return value of r is the gambling result. Needless to say, the house always has an advantage and I cannot understand the maths behind it.

R的返回值是赌博结果。不用说,房子总是有优势的,我无法理解它背后的数学原理。


Some other considerations:

其他一些注意事项:


An SHA-256 hash of the server key is published before a game. After the game, I verified all the hashes and they are all correct including the real result with the output from the Transform function.

服务器密钥的SHA-256散列在游戏之前发布。游戏结束后,我验证了所有的散列,它们都是正确的,包括从转换函数输出的实际结果。


Now, my question is without having any control over the 3 players before the round starts, how does the house maintain a consistent advantage?

现在,我的问题是,在这轮比赛开始之前,如果没有对三名球员的任何控制,球队如何保持持续的优势?


P.S.: I have done some digging where I have taken the server key from a high-winning game and then added player keys from low-winning games, and there is no discernible bias towards anything.

附注:我已经做了一些挖掘,我从高胜率游戏中提取了服务器密钥,然后添加了低胜率游戏的玩家密钥,并没有明显的偏向任何东西。


更多回答

How is the winner determined? Is it the person who guesses r most closely? Something else? What is the payout? 2:1?

获胜者是如何确定的?是不是猜得最准的那个人?还有别的事吗?奖金是多少?2:1?

Anyone who guesses lower than the generated float but above 1. If the generated number is higher by at least 0.1, the player wins his bet amount times the guess amount.

任何猜测低于生成的浮点数但大于1的人。如果生成的数字大于至少0.1,则玩家赢得赌注金额乘以猜测金额。

优秀答案推荐

There's no intrinsic cryptographic advantage in this scheme; it's all in the post-processing and the rules. First, let's talk about the cryptographic aspects.

该方案没有固有的加密优势;这完全取决于后处理和规则。首先,我们来谈谈加密方面的问题。


It's possible to generate random values, such as for shuffling a deck of cards, by having each person (server included) generate a random value and use what's called a commitment scheme to commit to the value, and then everyone other than the server reveals their random value to the server. The server hashes the values, including its own, in a deterministic way, and then uses that as the seed. The seeds are revealed at the end, and we can calculate the value. The commitment scheme prevents anyone from changing their seed after seeing other values, or from claiming that they submitted a different seed than they did.

通过让每个人(包括服务器)生成一个随机值并使用所谓的承诺方案来提交该值,可以生成随机值,例如用于洗一副牌,然后服务器以外的每个人向服务器透露他们的随机值。服务器以确定性的方式散列值,包括它自己的值,然后将其用作种子。种子在最后显露出来,我们可以计算出价值。承诺方案防止任何人在看到其他值后更改他们的种子,或者声称他们提交的种子与他们提交的种子不同。


That being said, the secure cryptographic hash functions we use in everyday life (usually SHA-2, SHA-3, and BLAKE2) are typically modeled as being indistinguishable from random. Thus, given the first 13 digits of SHA-512, all values are believed to be equally likely to appear. So there's something else going on that gives the house an advantage.

也就是说,我们在日常生活中使用的安全加密散列函数(通常是SHA-2、SHA-3和BLAKE2)通常被建模为与随机无法区分。因此,给出SHA-512的前13位数字,相信所有值出现的可能性都是一样的。因此,还有其他一些事情正在发生,这让房子变得更有优势。


You'll notice that 13 hex characters are used. That means the possible values of d are 0 to 2^52 - 1. If d is 0, then r is 1, and the result is 0.96. That means that such a game is unwinnable, because nobody can guess more than 1 and still lower than 0.96. Note that if d is the max value, then the result is still less than 2^52, which means even 1 in 2^52 times, you still can't beat the odds. That's because of the multiplier 0.96, which gives the house an advantage.

您会注意到使用了13个十六进制字符。这意味着d的可能值是0到2^52 - 1。如果d为0,则r为1,结果为0.96。这意味着这样的游戏是不可能赢的,因为没有人能猜到大于1但仍然小于0.96。请注意,如果d是最大值,那么结果仍然小于2^52,这意味着即使2^52次中有1次,你仍然无法击败赔率。这是因为乘数0.96,这给了房子一个优势。


The usage of the floor value is also very interesting here, because it gives the house more of an advantage by further lowering the value of r. Remember, the result of this function must be higher than the guess by 0.1 for the guess to win, so since most values are small (the result of the hash input 0x7ffffffffffff, the midpoint, is 1.98), the user will likely win very little most of the time they do win.

下限值的使用在这里也非常有趣,因为它通过进一步降低r的值而给房子带来了更多的优势。请记住,该函数的结果必须比猜测的结果高0.1,猜测才会获胜,所以由于大多数值都很小(散列输入0x7ffffffffffff的结果,中点是1.98),用户很可能在大多数情况下赢得很少的胜利。


更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com