Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contracts/generateSigningKeypair: Doc explicit sk size #437

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions contracts/contracts/Sapphire.sol
Original file line number Diff line number Diff line change
Expand Up @@ -321,16 +321,27 @@ library Sapphire {
* ##### Secp256r1: 4,000 gas
* - `7` (`Secp256r1PrehashedSha256`)
*
* #### Public Key Format
* ##### Secp384r1: 18,000 gas
* - `8` (`Secp384r1PrehashedSha384`)
*
* #### Key Formats
*
* ##### Ed25519
*
* 32 bytes
* Public key: 32 bytes
* Secret key: 32 bytes
*
* ##### Secp256k1 & Secp256r1
*
* 33 bytes, compressed format (`0x02` or `0x03` prefix, then 32 byte X
* coordinate).
* Public key: 33 bytes, compressed format (`0x02` or `0x03` prefix, then 32
* byte X coordinate).
* Secret key: 32 bytes
*
* ##### Secp384r1
*
* Public key: 49 bytes, compressed format (`0x02` or `0x03` prefix, then 48
* byte X coordinate).
* Secret key: 48 bytes
*
* #### Example
*
Expand All @@ -344,8 +355,8 @@ library Sapphire {
* @param alg The signing alg for which to generate a keypair.
* @param seed The seed to use for generating the key pair. You can use the
* `randomBytes` method if you don't already have a seed.
* @return publicKey The public half of the keypair.
* @return secretKey The secret half of the keypair.
* @return publicKey The public part of the keypair.
* @return secretKey The secret part of the keypair.
*/
function generateSigningKeyPair(SigningAlg alg, bytes memory seed)
internal
Expand Down Expand Up @@ -392,6 +403,8 @@ library Sapphire {
* bytes) as context, empty message.
* - `7` (`Secp256r1PrehashedSha256`): 9,000 gas, pre-existing hash (32
* bytes) as context, empty message.
* - `8` (`Secp384r1PrehashedSha384`): 43,200 gas, pre-existing hash (32
* bytes) as context, empty message.
*
* #### Example
*
Expand Down Expand Up @@ -450,6 +463,7 @@ library Sapphire {
* - `4` (`Secp256k1PrehashedKeccak256`): 3,000 gas
* - `5` (`Secp256k1PrehashedSha256`): 3,000 gas
* - `7` (`Secp256r1PrehashedSha256`): 7,900 gas
* - `8` (`Secp384r1PrehashedSha384`): 37,920 gas
*
* #### Example
*
Expand Down
Loading