Code Monkey home page Code Monkey logo

Comments (2)

bun919tw avatar bun919tw commented on June 14, 2024 2

Hi @LorenzoAlluminio

I believe you are using codes from /example to generate the signature. The message in our example is not encrypted. Therefore, you don't need to sha256() the message. I changed your code as following and it works.

from ecpy.curves     import Curve,Point
from ecpy.keys       import ECPublicKey, ECPrivateKey
from ecpy.ecdsa      import ECDSA
import ecpy
from hashlib         import sha256

x = 47143094896967716337843669989860432144962851204356940818421228324575441222601
y = 23336444423741848139737884993242101588835841992098573257496438799812162311375

r = 27879350651684890904379932074025120345051153878425154998302508662105071749243
s = 25794953212301227856184311444869449493787798218601311881180217027281849030507

cv   = Curve.get_curve('secp256k1')
pu_key = ECPublicKey(Point(x, y, cv))
sig = ecpy.ecdsa.encode_sig(r, s, 'RAW', 32)
signer = ECDSA(fmt='RAW')
msg = b'hello tss'
print(signer.verify(msg,sig,pu_key))

Normally, the message would be hashed (e.g transaction hash in cryptocurrency). However, we don't want to limit Alice to only serve cryptocurrency field. If you want to use hashed message, you should change the code here (hash the message before passing it to NewService).

from alice.

lorenzo-dev1 avatar lorenzo-dev1 commented on June 14, 2024 1

Thanks a lot!!
That clarifies everything :)

from alice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.