Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
nomachine
on 01/11/2023, 16:01:57 UTC
can you explain more about what exactly is happening here:

Code:
#Random seed Config
#constant_prefix = b''  #back to no constant
#constant_prefix = b'\xbc\x9b\x8cd\xfc\xa1?\xcf' #Puzzle 50 seed - 10-18s
constant_prefix = b'\xbc\x9b\x8cd\xfc\xa1?\xcf'
prefix_length = len(constant_prefix)
length = 8
ending_length = length - prefix_length
with open("/dev/urandom", "rb") as urandom_file:
    ending_bytes = urandom_file.read(ending_length)
random_bytes = constant_prefix + ending_bytes
print(f"[+] [Core]: {core_number+1:02}, [Random seed]: {random_bytes}")
random.seed(random_bytes)

...it looks like you start with whatever this is, a hard-coded byte string or something?

Code:
b'\xbc\x9b\x8cd\xfc\xa1?\xcf'

...and then you go on to read more, random bytes from some file on disk? As a Windows/C# guy, I just can't quite grok what's happening here  Huh  Any help would be much appreciated  Cheesy


It is a random seed for Puzzle 50 in kangaroo.

Code:
random_bytes = b'\xbc\x9b\x8cd\xfc\xa1?\xcf'

random.seed(random_bytes) is a function in Python used to initialize the random number generator with a specific seed value. In this context, random_bytes is typically a sequence of bytes or an integer used as the seed. When you provide a seed value to the random number generator, it ensures that the sequence of random numbers generated will be reproducible. In other words, if you use the same seed value, you will get the same sequence of random numbers every time you run kangaroo program.

Every time you request a random number using functions like random.randint(), random.random(), or others from the random module, it generates the next number in the sequence based on the seed value and an algorithm.

Because the generator is initialized with the same seed each time you run your program, you get the same sequence of random numbers - same kangaroo jumps - and same time for solving Puzzle  Wink