V
V
vzKY9P2021-03-16 16:21:31
Python
vzKY9P, 2021-03-16 16:21:31

Why am I getting a non-standard result when defining constants for SHA-256?

from math import sqrt
fractional_part = int(str(sqrt(2)).split('.')[1]) # получение дробной части кв. корня из 2
binary_32 = bin(fractional_part)[2:34] # получение первых 32 битов из fractional_part
for_hex = int(binary_32, 2) # hex не принимает недесятичные числа
print(hex(for_hex) == '0x6a09e667') # -> False

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vzKY9P, 2021-03-26
@vzKY9P

https://coderoad.ru/4674956

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question