Вопрос по C# - Visavi.net https://visavi.net/ RSS - Visavi.net https://visavi.net/assets/img/images/logo_small.png RSS - Visavi.net https://visavi.net/ [email protected] (admin) [email protected] (admin) Sat, 23 Nov 2024 01:43:21 +0300 Ребя кто шарит в &quot;сишке&quot; не могу понять один код, хочу в php перевести, вот:<pre class="prettyprint">static bool VerifyBetResult(string serverSeed, int clientSeed, int betNumber, long betResult, string serverSeedHash = null) { Func&lt;string, byte&#91;]&gt; strtobytes = s =&gt; Enumerable .Range(0, s.Length / 2) .Select(x =&gt; byte.Parse(s.Substring(x * 2, 2), NumberStyles.HexNumber)) .ToArray(); byte&#91;] server = strtobytes(serverSeed); byte&#91;] client = BitConverter.GetBytes(clientSeed).Reverse().ToArray(); byte&#91;] num = BitConverter.GetBytes(betNumber).Reverse().ToArray(); byte&#91;] serverhash = serverSeedHash == null ? null &#58; strtobytes(serverSeedHash); byte&#91;] data = server.Concat(client).Concat(num).ToArray(); using (SHA512 sha512 = new SHA512Managed()) { if (serverhash != null) using (SHA256 sha256 = new SHA256Managed()) if (!sha256.ComputeHash(server).SequenceEqual(serverhash)) throw new Exception(&quot;Server seed hash does not match server seed&quot;); byte&#91;] hash = sha512.ComputeHash(sha512.ComputeHash(data)); while (true) { for (int x = 0; x &lt;= 61; x += 3) { long result = (hash&#91;x] &lt;&lt; 16) | (hash&#91;x + 1] &lt;&lt; 8) | hash&#91;x + 2]; if (result &lt; 16000000) return result % 1000000 == betResult; } hash = sha512.ComputeHash(hash); } } }</pre> Помогите разобраться плз https://visavi.net/topics/42900/688481 Вопрос по C# Александр Sun, 13 Mar 2016 18:53:18 +0300 Сообщения https://visavi.net/topics/42900/688481