MCPcopy Create free account
hub / github.com/C2SP/CCTV / sample

Function sample

ML-DSA/benchmark/src/stat.py:116–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114# sample returns an input message, and a list of rejection causes it encounters,
115# from "z", "r0", "z/r0", "h".
116def sample():
117 # Running "bin/go test crypto/internal/fips140/mldsa -run TestSample/ML-DSA-44 -v -count 1" produces:
118 #
119 # === RUN TestSample
120 # === RUN TestSample/ML-DSA-44
121 # seed: ZAI62RWMNI4MANGIWMBGAT7BME
122 # rejection: r0
123 # rejection: z/r0
124 # rejection: z
125 # rejection: r0
126 # --- PASS: TestSample (0.00s)
127 # --- PASS: TestSample/ML-DSA-44 (0.00s)
128 # PASS
129 # ok crypto/internal/fips140/mldsa 0.183s
130 import subprocess
131 proc = subprocess.run(
132 ["./mldsa.test", "-test.run", f"TestSample/ML-DSA-{sys.argv[1]}", "-test.v", "-test.count", "1"],
133 capture_output=True,
134 text=True,
135 )
136 lines = proc.stdout.splitlines()
137 seed_line = next(line for line in lines if line.startswith("seed: "))
138 seed = seed_line[len("seed: "):]
139 rejections = [line[len("rejection: "):] for line in lines if line.startswith("rejection: ")]
140 return (seed, rejections)
141
142remaining_only_z = fails_only_z
143remaining_only_r0 = fails_only_r0

Callers 1

stat.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected