Skip to content

Instantly share code, notes, and snippets.

@dymurray
Created November 16, 2018 20:04
Show Gist options
  • Save dymurray/ae77b54881fc3a815f9ffd176af94a89 to your computer and use it in GitHub Desktop.
Save dymurray/ae77b54881fc3a815f9ffd176af94a89 to your computer and use it in GitHub Desktop.
import ecdsa
import ecdsa.ellipticcurve as EC
curve = ecdsa.SECP256k1
x = int('11db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5c', 16)
y = int('b2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3', 16)
point = EC.Point(curve.curve, x, y)
pubkey = ecdsa.VerifyingKey.from_public_point(point, curve)
hash1 = 90774958364900180671716888080665726921328827653065727390791155349203800699667
r1 = 97921318692748166969765893503724782362221860890089306445657980140065784098104
s1= 17870770544568028453805091504963125490615703388985597936947183001452377396233
sig = ecdsa.ecdsa.Signature(r1, s1)
if pubkey.pubkey.verifies(hash1, sig):
print("Good")
else:
print("Bad")
hash1 = 70438975929202441702137589012525894517177874894451752259863210250765743151652
r1 = 67469108926628898148530592947733862172872496318648607111578457920563549925544
s1= 48322980310687297275040392060954045679965067960426297271026705220954611568793
sig = ecdsa.ecdsa.Signature(r1, s1)
if pubkey.pubkey.verifies(hash1, sig):
print("Good")
else:
print("Bad")
@mflaxman
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment