interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / seed / qualification / om2 / fixtures / oracle / fipschk.py

10 lines · 686 bytes Raw Blame History
1# Compare bc-derived K/H (kiv.out) with the hex tables extracted by pdftotext from NIST.FIPS.180-4.pdf.
2import re, sys
3t = open(sys.argv[1]).read().split("\n")
4k = " ".join(t[585:593]).split() # lines 586-593: section 4.2.2 SHA-256 K
5h = [re.search(r"= ([0-9a-f]{8})\b", t[i].strip()).group(1) for i in range(729, 737)] # 5.3.3
6assert len(k) == 64 and all(re.fullmatch(r"[0-9a-f]{8}", x) for x in k)
7got = [l.split() for l in open(sys.argv[2])]
8assert [int(x, 16) for x in k] == [int(g[3]) for g in got if g[0] == 'K']
9assert [int(x, 16) for x in h] == [int(g[3]) for g in got if g[0] == 'H']
10print("PASS bc K[0..63] and H(0)[0..7] equal FIPS 180-4 sections 4.2.2 and 5.3.3")