Python code for those of you who are looking to create 100 or more R,s,z signatures. The sigs are created via the public key.
However, it is important to note that these signatures would not be unique and would not have any real-world meaning or value. Here is an example in Python using the cryptography library:
import os
import hashlib
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
private_key = ec.generate_private_key(ec.SECP256K1(), default_backend())
public_key = private_key.public_key()
for i in range(100):
data = os.urandom(32)
signature = private_key.sign(data, ec.ECDSA(hashes.SHA256()))
# Extract the values of 'r', 's', 'z' from the signature
r, s = signature
z = int.from_bytes(hashlib.sha256(data).digest(), 'big')
# Print the values of 'r', 's', 'z'
print("r:", r)
print("s:", s)
print("z:", z)
If you need to make more, change the 100 here to any amount you need.
for i in range(100):
Just giving you guys a little help.
Cheers.
And here is the code to generate 100 signatures with k nonce reveal.
import ecdsa
import random
# Define the secp256k1 curve
curve = ecdsa.SECP256k1
# Generate 100 random private keys
private_keys = [ecdsa.SigningKey.generate(curve=curve) for i in range(100)]
# Create signatures using the private keys and random messages (z)
signatures = []
for i in range(100):
z = random.randint(0, 2**256)
private_key = private_keys[i]
public_key = private_key.get_verifying_key()
signature = private_key.sign_digest(z.to_bytes(32, 'big'), sigencode=ecdsa.util.sigencode_der)
r, s = ecdsa.util.sigdecode_der(signature, curve.generator.order())
signatures.append((z, r, s))
# Get the nonce (k) for each signature
nonce = []
for i in range(100):
z, r, s = signatures[i]
k = ecdsa. SigningKey.from_public_key(public_key, curve=curve).verifying_key.recover_session_key(z.to_bytes(32, 'big'), (r, s), hashfunc=ecdsa.util.sha256, sigdecode=ecdsa.util.sigdecode_der)
nonce.append(k)
# The 100 signatures, Z values, and nonce values are stored in the signatures, Z, and nonce lists, respectively.
Bro can you make a code for sigh with enother curve with enother order and another base point ? This curve is a twist of secp256k1
p = 115792089237316195423570985008687907853269984665640564039457584007908834671663
data of a Bae Point P11 = E1([85121563011366687025707822879925964033143920255507899862530934382179124106759, 42409656727948788569510737393982221864295921023467166630061319157315739523945])