Bitcoin Forum
May 02, 2024, 08:24:13 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [40]
781  Economy / Services / Re: ★☆★ 777Coin Signature & Personal MSG Campaign ★☆★ Newb to Hero [RE-OPEN] on: February 28, 2015, 08:58:22 AM
I want to enroll this campaign Smiley
Rank : newbie
Activity : 3
post : 3
Adress : 1FkhVFpUFhwCFmLo3ikTeeC9boqeZsGabc
782  Economy / Digital goods / FACEBOOK FAN PAGE !!! (sale)!!!!!! on: February 28, 2015, 08:25:52 AM
 Cheesy here is a face fanpage on sale just for 0.2btc.
we can talk about price if u want to but it.
send me PM Smiley

https://www.facebook.com/pages/Obamas-joke/570459499736272
783  Other / Beginners & Help / INVEST BITCOIN!!! on: February 26, 2015, 12:34:37 PM
WHERE CAN I TRUST 100% TO INVEST MY COINS for garentee payback
CAN ANY ONE SUGGEST ME ?
784  Economy / Gambling / Fair bets in dice sites !!! on: February 26, 2015, 12:18:46 PM
I want to attract the programmers to check those programs are really fair ??

Here is the actual SQL function ...... site uses.

create function dbo.CalculateBetResult
(
   @serverSeed binary(32),
   @clientSeed binary( 8 )
)
returns bigint
as
begin
   declare @hash binary(64)
   declare @index int
   declare @r bigint
   
   set @hash = HASHBYTES('SHA2_512', @serverSeed+@clientSeed)
   set @hash = HASHBYTES('SHA2_512', @hash)
   while 1=1
   begin
      
      set @index = 1
      while @index <= 64 - 3
      begin
         set @r = cast(substring(@hash, @index, 3) as bigint)
         if @r < 16000000
            return @r % 1000000
         set @index += 3
      end

      set @hash = HASHBYTES('SHA2_512', @hash)

   end
   return -1
end

------------------------------------------------------------------------------------------------------------------------------------------------


And here is some C# code you could also use to verify results.


static bool VerifyBetResult(string serverSeed, int clientSeed, int betNumber,
                            long betResult, string serverSeedHash = null)
{
    Func<string, byte[]> strtobytes = s => Enumerable
        .Range(0, s.Length / 2)
        .Select(x => byte.Parse(s.Substring(x * 2, 2), NumberStyles.HexNumber))
        .ToArray();
    byte[] server = strtobytes(serverSeed);
    byte[] client = BitConverter.GetBytes(clientSeed).Reverse().ToArray();
    byte[] num = BitConverter.GetBytes(betNumber).Reverse().ToArray();
    byte[] serverhash = serverSeedHash == null ? null : strtobytes(serverSeedHash);
    byte[] 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("Server seed hash does not match server seed");
        byte[] hash = sha512.ComputeHash(sha512.ComputeHash(data));
        while (true)
        {
            for (int x = 0; x <= 61; x += 3)
            {
                long result = (hash
  • << 16) | (hash[x + 1] << 8 ) | hash[x + 2];
               if (result < 16000000)
                    return result % 1000000 == betResult;
            }
            hash = sha512.ComputeHash(hash);
        }
    }
}
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [40]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!