Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #38005

Re: Need some help confirming transactions using sha256

From Peter Pearson <ppearson@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: Need some help confirming transactions using sha256
Date 2013-01-31 17:55 +0000
Message-ID <amvpfoF7s8gU1@mid.individual.net> (permalink)
References <21037ba0-57e5-4e44-8d50-6503a1187492@googlegroups.com>

Show all headers | View raw


On Thu, 31 Jan 2013 08:43:03 -0800 (PST), kryptox.exchange@gmail.com wrote:

> I'm wondering if anyone can help me as I can't seem to get
> this to work. There is an online dice game that is
> provably fair by calculating the 'dice roll' using using a
> sha256 hash calculated against my transaction ID generated
> by me. The secret used to make the calculation is revealed
> at the end of each day thus allowing you to prove they
> didn't cheat. So they provide the following to allow you
> to verify the calculation of the dice roll:
>
> Secret used = r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA
> Secret hash sha256(r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA) = 48d78d573b9b8e11a13a72d9a78011f2e5d9754d89de47b209f32c51777f535d
> Lucky hash sha256(r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA:108128 06653842663997bf5971637f86f26c71a4716276d7fa8f323a83588d91:1) = dfa8769be81a543002865c88a5b52fa07f3b67fc7cd9b519c3f6a6452bcd48e4
>
> Lucky Number 0x48e4 = 18660
>
> So, I'm doing the following:
>
> C:\Python27>python
> Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import hashlib, hmac
>>>> txid = 'r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA'
>>>> secret = '10812806653842663997bf5971637f86f26c71a4716276d7fa8f323a83588d91:1'
[snip]

>>> txid = 'r7A7clvs9waizF+6QEiI0tgAq1ar48JItK3kg9kaeAFXz2vsMsHmOd9r9fhkmtxTz3CQnGAPMaDeKLvgb1A2VA'
>>> secret = '10812806653842663997bf5971637f86f26c71a4716276d7fa8f323a83588d91:1'
>>> hashlib.sha256(txid+":"+secret).hexdigest()
'dfa8769be81a543002865c88a5b52fa07f3b67fc7cd9b519c3f6a6452bcd48e4'
>>> 0x48e4
18660
>>> 

. . . which is the number you wanted, right?


-- 
To email me, substitute nowhere->spamcop, invalid->net.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Need some help confirming transactions using sha256 kryptox.exchange@gmail.com - 2013-01-31 08:43 -0800
  Re: Need some help confirming transactions using sha256 kryptox.exchange@gmail.com - 2013-01-31 09:30 -0800
  Re: Need some help confirming transactions using sha256 Peter Pearson <ppearson@nowhere.invalid> - 2013-01-31 17:55 +0000
    Re: Need some help confirming transactions using sha256 kryptox.exchange@gmail.com - 2013-01-31 10:44 -0800
    Re: Need some help confirming transactions using sha256 Christian Heimes <christian@python.org> - 2013-02-01 15:34 +0100

csiph-web