A366061
Numbers of iterations that produce a record low of the digest of the SHA2-256 hash of the empty string.
Original entry on oeis.org
1, 2, 6, 7, 36, 674, 815, 11621, 449652, 2386324, 2643745, 187894152, 704719562, 1390873253, 1625785299, 3479964180, 6909167935, 12446961112
Offset: 1
a(1) = 1 because 1 iteration sha256("") = hex e3b0...b855 is taken as the first digest and so is a record.
a(2) = 2 is the next term since 2 times nested sha256(...(sha256("")...)) = hex 5df6...9456 is less than the previous record e3b0...b855.
-
from itertools import islice
import hashlib
def g():
c, vmin, m = 1, b"\xFF" * 32, b""
while True:
if (m:= hashlib.sha256(m).digest()) < vmin:
vmin = m
yield c
c += 1
print(list(islice(g(), 16)))
A378628
SHA-256 hash of binary strings ordered by length then lexicographically, interpreting the bits of the resulting hash as a number in binary.
Original entry on oeis.org
102987336249554097029535212322581322789799900648198034993379397001115665086549, 85627803894273957621009139791088467240572419248799306945317937552975942820725, 84071438648566403273885734069370854758478523414599514048347910236850479717025, 91949452561369181223012808967964775320445203057864513807052896586217122700773
Offset: 1
For n = 1, there are no bits after the most significant 1 bit, so a(1) is the SHA-256 hash of the empty string.
For n = 6 = 110_2, the bits after the most significant 1 are 10, so a(5) is the SHA-256 hash of the bits 10.
-
# See links
-
from sha256bit import Sha256bit
def a(n):
s = bin(n)[3:]
t = bytearray(int(s[i*8:i*8+8].ljust(8, "0"), 2) for i in range((len(s)+7)//8)) if n > 1 else ""
return int(Sha256bit(t, bitlen=len(s)).hexdigest(), 16)
print([a(n) for n in range(1, 5)]) # Michael S. Branicky, Dec 08 2024
Showing 1-2 of 2 results.
Comments