You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
2.1 KiB

  1. function test() {
  2. let m = "1952805748";
  3. console.log("using: https://sci-hub.do/10.1109/ICCKE.2013.6682844");
  4. // R would be received from the Signer
  5. let signerRx = "17814783168156809976981325336969869272256267559847863501362979416582031885685";
  6. let signerRy = "30466749656160766323378925376290982172805224557687141285291181575233995759897";
  7. let blindRes = wasmBlind(m, signerRx, signerRy);
  8. console.log("blind", blindRes);
  9. // Q & sBlind would be received from the Signer
  10. let signerQx = "91217724741799691300838336208439702708830781279546234509900618215893368170964";
  11. let signerQy = "10647409378909561143830454293907272341812664755625953321604115356883317910171";
  12. let sBlind = "1559989683738317700055715706344460781046571016142996697444777749433194958666958401306508176561868963591508234625762518936896506645022493420447764027537091595268073646775253821735958788229615883133396107736168033688269069669796190509031136746898237132145138091815479880246793211708356184248484212425679897377";
  13. let unblindRes = wasmUnblind(sBlind, blindRes.uA, blindRes.uB, blindRes.uFx, blindRes.uFy);
  14. console.log("unblind", unblindRes);
  15. // wasmVerify method not used here because the hardcoded values would
  16. // not match with the random generated values from the 'blind' method
  17. // let verified = wasmVerify(m, unblindRes.s, unblindRes.fx, unblindRes.fy, signerQx, signerQy);
  18. // console.log("verify", verified);
  19. // ---
  20. // v0
  21. console.log("using: http://www.isecure-journal.com/article_39171_47f9ec605dd3918c2793565ec21fcd7a.pdf");
  22. // Q & R would be received from the Signer
  23. blindRes = wasmBlindv0(m, signerQx, signerQy, signerRx, signerRy);
  24. console.log("blindv0", blindRes);
  25. // sBlind would be received from the Signer
  26. unblindRes = wasmUnblindv0(sBlind, blindRes.uB, blindRes.uC, blindRes.uFx, blindRes.uFy);
  27. console.log("unblindv0", unblindRes);
  28. // wasmVerifyv0 method not used here because the hardcoded values would
  29. // not match with the random generated values from the 'blind' method
  30. // let verified = wasmVerifyv0(m, unblindRes.s, unblindRes.fx, unblindRes.fy, signerQx, signerQy);
  31. // console.log("verify", verified);
  32. }