(r, s) signature. how to calculate s
时间: 2024-05-30 21:10:20 浏览: 96
calculate(java).rar_Calculate.ja_calculate java_calculate.java
To calculate the "s" value in an (r, s) signature, you first need to have the following information:
1. The message being signed
2. The signer's private key
3. The "r" value, which is the output of the signature algorithm's deterministic generation function
Once you have this information, you can calculate "s" as follows:
1. Calculate the hash of the message using the same hash function used in the signature algorithm. Let's call this hash value "h".
2. Calculate the inverse of the signer's private key modulo the order of the elliptic curve group being used. Let's call this inverse "k_inv".
3. Multiply the signer's private key by "r" and add "h" to the result. Let's call this value "numerator".
4. Multiply "k_inv" by "numerator" modulo the order of the elliptic curve group being used. This will give you the "s" value.
Mathematically, the calculation of "s" can be represented as:
s = k_inv * (r * private_key + h) mod order
It's important to note that the "s" value in an (r, s) signature is unique to each message and private key combination.
阅读全文