Skip to content

Differenct signature result with other libraries #296

Closed
@FaiChou

Description

@FaiChou

I am using the sample code to test:

let privateBytes = try! "14E4A74438858920D8A35FB2D88677580B6A2EE9BE4E711AE34EC6B396D87B5C".bytes
let privateKey = try! secp256k1.Signing.PrivateKey(rawRepresentation: privateBytes)
print("private key: \(String(bytes: privateKey.rawRepresentation))")
print("public key: \(String(bytes: privateKey.publicKey.rawRepresentation))")
// ECDSA
let str = "We're all Satoshi."
let messageData = str.data(using: .utf8)!
let signature = try! privateKey.ecdsa.signature(for: messageData)
print("signature: \(String(bytes: signature.rawRepresentation))")

the results are:

private key: 14e4a74438858920d8a35fb2d88677580b6a2ee9be4e711ae34ec6b396d87b5c
public key: 02734b3511150a60fc8cac329cd5ff804555728740f2f2e98bc4242135ef5d5e4e
signature: 09b7cc8f9c570c6cec33e926615879c7b4ad0dbdfed2180d893f0de50d31063e1201f0847ea4b43c4e3f13955a19a53f52a9a7eddaec3368efa2a45d172bf456

When I put the same private key and message to the other libraries, the values are not the same, you can test on the website: https://paulmillr.com/noble/

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions