mirror of
https://github.com/erlang-punch/nostr
synced 2026-04-15 01:04:44 +00:00
This (very) huge commit is containing the whole implementation of the Schnorr signature scheme and the NIP/01 standard in full Erlang. It includes documentation, test suites with eunit and commont_test, partial specification, and articles/notes on the implementation. This commit is also probably one of the most important, it defines the structure of the nostrlib module and all the low level record used to encode and decode events. 99% coverages on nostrlib_schnorr. 85% on nostrlib.
25 lines
484 B
Python
25 lines
484 B
Python
#!/usr/bin/env python3
|
|
# check_mod.py
|
|
"""
|
|
This script is used to check custom modulo operator created
|
|
in Erlang for the nostr project.
|
|
"""
|
|
|
|
import sys
|
|
import string
|
|
import secrets
|
|
|
|
limit = 256
|
|
if len(sys.argv) > 1:
|
|
limit = int(sys.argv[1])
|
|
|
|
generator = secrets.SystemRandom()
|
|
start = -(2**256)
|
|
end = 2**256
|
|
for i in range(limit):
|
|
a = generator.randrange(start, end)
|
|
m = generator.randrange(0,end)
|
|
r = a % m
|
|
l = ",".join([str(i),str(a),str(m),str(r)])
|
|
print(l)
|