mirror of
https://github.com/selfxyz/self.git
synced 2026-01-09 14:48:06 -05:00
feat: add new verifiers (#1049)
* feat: add new verifiers * format: contracts
This commit is contained in:
@@ -37,76 +37,76 @@ contract Verifier_vc_and_disclose {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 14324652197233524730641128864453952705287261438027941215119848149313687821891;
|
||||
uint256 constant deltax2 = 21484419249698297517228580410359777419164148894816781833836153164365935289751;
|
||||
uint256 constant deltay1 = 16582639760164029271670474683933633491275197367453348914396759452543655643766;
|
||||
uint256 constant deltay2 = 403364129427239992507797759205273357623430219990520056171053424359490948488;
|
||||
uint256 constant deltax1 = 16003296527668925742863515818275579351356339601946180391890101479883479175048;
|
||||
uint256 constant deltax2 = 19984896270701531499196389858214296071784225307233905736778009760168662407770;
|
||||
uint256 constant deltay1 = 5138655595787089892482835352178966166781128102524280116487962013964720103607;
|
||||
uint256 constant deltay2 = 1217532993718676692158820192374740421387705198527773729064132560667312540512;
|
||||
|
||||
uint256 constant IC0x = 5807421164254058694768562974091556471982618906409701089817378417825836236343;
|
||||
uint256 constant IC0y = 4762128381603790376888559194340882557264389099298755687176588554202025724461;
|
||||
uint256 constant IC0x = 5596963095588548215463373338908863751044901017738158737470568961739673965961;
|
||||
uint256 constant IC0y = 197014595429711666232705760798810381313943401644903632013191386416875480347;
|
||||
|
||||
uint256 constant IC1x = 16662390513821057352794413094488187612031938804807079860864108802496451001816;
|
||||
uint256 constant IC1y = 10297510270592678540657167982591525863128041683855232684458106298771022792321;
|
||||
uint256 constant IC1x = 5205997661858310131019668271478592188796010857087211482717528768703330586157;
|
||||
uint256 constant IC1y = 13176893502345648015788198894995265386937497795228160152334741440356148760775;
|
||||
|
||||
uint256 constant IC2x = 7653025634029084987308170086828490275298599740834466183953126955197487414356;
|
||||
uint256 constant IC2y = 19645385561052696065344838011986430522165661506559202243279342170061964546655;
|
||||
uint256 constant IC2x = 18686575958474802319284536716008271197119798202369722729545536852821555672502;
|
||||
uint256 constant IC2y = 3215233739805959113477947017922133477171290691316010120728592048201282926316;
|
||||
|
||||
uint256 constant IC3x = 10511361376569345195406025469041361191651442241768535575261966054173983787397;
|
||||
uint256 constant IC3y = 4753267144655208758494954970965128596785915703954332029494912918157374545900;
|
||||
uint256 constant IC3x = 1055127295460550191570931643553037666433550808218997758502836878984684391612;
|
||||
uint256 constant IC3y = 6635530946691458473442812686202910426342274602603661196235658534469306652670;
|
||||
|
||||
uint256 constant IC4x = 17891598869612007035497347537395151468322232625646857061035566440141799353157;
|
||||
uint256 constant IC4y = 7327472162072976666976779150327124950314720612127324807495386441616338368867;
|
||||
uint256 constant IC4x = 1176481886486243698849395799015692190365205425437354380942590868210339561547;
|
||||
uint256 constant IC4y = 11032707277468575718219050081069609294195714593272361592511167680044356246676;
|
||||
|
||||
uint256 constant IC5x = 19379848679264073687952185691016095700021268381890295930462472788745053969888;
|
||||
uint256 constant IC5y = 19164887608566056729336084782278913102562387728008861526609638975081522984209;
|
||||
uint256 constant IC5x = 21472746513384679694076117414900521235398567169230511281372877399956105858021;
|
||||
uint256 constant IC5y = 563092790680798493082477969374982298318954854173051786179456245393201893102;
|
||||
|
||||
uint256 constant IC6x = 9052597422036659198765116771520013601665763509526356714069889986137129899304;
|
||||
uint256 constant IC6y = 17053984243050986442970381835166298254892607442877935692807165714510713974133;
|
||||
uint256 constant IC6x = 13601138852852403856005944646975090972729648614966676409231172122638333974547;
|
||||
uint256 constant IC6y = 3581105645906785730892656040994982459922202487976234152960491483044370048575;
|
||||
|
||||
uint256 constant IC7x = 21406785126691449735393464427941713640943869278510912368181929030568455096470;
|
||||
uint256 constant IC7y = 15441344638363214564807483754052042320000169836576212379606121941073936072663;
|
||||
uint256 constant IC7x = 6157557994850342948856683835911743140429039440220926429072418330957123608019;
|
||||
uint256 constant IC7y = 17388180375008418233457359417526833014165004918527650588909336131820427902612;
|
||||
|
||||
uint256 constant IC8x = 14584635132883462229965362975544665981679994676845588706509348488004715407495;
|
||||
uint256 constant IC8y = 11601978078524726660737255096987791198409734787446205351625590575308497682341;
|
||||
uint256 constant IC8x = 19544790484484484983818685444502423855480935224872533613761747434233145297100;
|
||||
uint256 constant IC8y = 3086922147265903956378031708647679668364443698616954000627119704330804346839;
|
||||
|
||||
uint256 constant IC9x = 18566856048382194815211582775829521113999452702204011689044527664589036829978;
|
||||
uint256 constant IC9y = 17564093409732961661054461664967275243454991970738432665314639276201066462465;
|
||||
uint256 constant IC9x = 4095001260637928303635953754907841429905765318689568133295242708426356192097;
|
||||
uint256 constant IC9y = 11201866687354690165969898890054530758881524395050433723353485108691384430582;
|
||||
|
||||
uint256 constant IC10x = 17578362792503922684070912668973950103584970370029615225140277040265536490684;
|
||||
uint256 constant IC10y = 10072295905096503524936898194115490761143012925095648887710751149646091643044;
|
||||
uint256 constant IC10x = 19897122716138572934585433218242234674962957249341493237507498893019713486242;
|
||||
uint256 constant IC10y = 21689091687047727664119058388835593061120184946270862215018621609047615882056;
|
||||
|
||||
uint256 constant IC11x = 11176021192691907097978774092559748731443899751874219959618393028316694443072;
|
||||
uint256 constant IC11y = 7376036693105311360497433586682614583706378369978487440906932493233217037539;
|
||||
uint256 constant IC11x = 5478252900725318753860283254407973861234833745169084257513502840647894550060;
|
||||
uint256 constant IC11y = 1791296742307044584126205288560498393897750881136190887025323159136398403555;
|
||||
|
||||
uint256 constant IC12x = 10327879881961641314568906321975805490180725947535905985095559856477223460641;
|
||||
uint256 constant IC12y = 3098196555307154489632503773862098128291153650586044744663532040499786471251;
|
||||
uint256 constant IC12x = 14795507180423659678567208590170058380783028172120947205106407450365097532473;
|
||||
uint256 constant IC12y = 10820601127512798821002861433402355623851630698577616863236044291614160298924;
|
||||
|
||||
uint256 constant IC13x = 6604007520188320681700111646215276820846531399504948949112735036053740363763;
|
||||
uint256 constant IC13y = 20391884831916732655879418660804444124587580108833621419350459984544674397658;
|
||||
uint256 constant IC13x = 1371307947996742453808445358832377756162415203013759111969902645610915102884;
|
||||
uint256 constant IC13y = 10979064264407256506966027217833361504889104814732489559103793054688600335381;
|
||||
|
||||
uint256 constant IC14x = 10573613170402755166663648598802974723655481690861311162091782780643794707507;
|
||||
uint256 constant IC14y = 12641603056766073029280139827316177764406532047489910983005142005327582366856;
|
||||
uint256 constant IC14x = 109788638163029769699092214797728443378801928834723847442030420151550653348;
|
||||
uint256 constant IC14y = 21855764518074664201856214595345297576098255265106979512083523259607952247044;
|
||||
|
||||
uint256 constant IC15x = 8032993249763900729871190151880778566348652063810342826940009101155352989062;
|
||||
uint256 constant IC15y = 21092275273423767728713685573433195066391399247575619321586800017516422017524;
|
||||
uint256 constant IC15x = 3483239985558231052997982184949030327610541095960983024278219968128420996301;
|
||||
uint256 constant IC15y = 14733921718987244788451642956589707498178006322890807039293135360881648657799;
|
||||
|
||||
uint256 constant IC16x = 6949369268030204146033557816152242151237750687177559659981302010033063636735;
|
||||
uint256 constant IC16y = 13024090575871988182743358095945594665255237391858718878203452318841792125483;
|
||||
uint256 constant IC16x = 14798732842280992927477761391955163343018141761671851666429268509498613724692;
|
||||
uint256 constant IC16y = 4455056645878601140444148446204168238779052860658115931655024263695173929532;
|
||||
|
||||
uint256 constant IC17x = 5696684074576718041337457228655364625810514470086764663343119291679037645981;
|
||||
uint256 constant IC17y = 20782688080692471786852240869791733265079471721127845164762298880982848762711;
|
||||
uint256 constant IC17x = 7736826968011671338791057639700188385088653935654554560239035205278727242893;
|
||||
uint256 constant IC17y = 500124354635552411023163921908192899897578217026396431383560884442758389341;
|
||||
|
||||
uint256 constant IC18x = 21493203180510390741347724896623560565563787646721333148184026110374233207598;
|
||||
uint256 constant IC18y = 19968375627992694416627843492698194729194287566868443998824242244337241469789;
|
||||
uint256 constant IC18x = 14998100555567060664437417744560818779123122162052297806706232682724037825765;
|
||||
uint256 constant IC18y = 21042787205915057944739845375687838358031355418400790550766487427122410219370;
|
||||
|
||||
uint256 constant IC19x = 5512336834611608721293525306829636603018046531962622983181968606257550005946;
|
||||
uint256 constant IC19y = 6009208085892191402468411187136512666153490634646230065964932723210132847100;
|
||||
uint256 constant IC19x = 16820751365714164024735961591109709928906102027280708691045408574326309130538;
|
||||
uint256 constant IC19y = 13969803504492496345541664178863570638687274552579034460891887717501487588820;
|
||||
|
||||
uint256 constant IC20x = 11460461063342597043144253617111356597266764770233533950860040127208500820081;
|
||||
uint256 constant IC20y = 19190306512992109897447125075053164890623026446048588795322662152517679283770;
|
||||
uint256 constant IC20x = 6300931722409788047719158584043307098783826800509826930873450623429686354711;
|
||||
uint256 constant IC20y = 3296077608321280418003957840869174287982028175759219453107764250219772326699;
|
||||
|
||||
uint256 constant IC21x = 1327828313007429340545265368612436322983926232135317070796976852822355973929;
|
||||
uint256 constant IC21y = 21048374296412833003371198781842749103037353560994844402966733372765619158064;
|
||||
uint256 constant IC21x = 8575934641343546340479763260628203666392881516995856567983301829732041115320;
|
||||
uint256 constant IC21y = 9883873130137129757933294169163215566229691629254682468566589714083960043129;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_vc_and_disclose_aadhaar {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 5975653288659314559173630546502289092915276110183298941132665434033184687659;
|
||||
uint256 constant deltax2 = 11932065747045745104975629046405083109064200133089076374778183349761377636122;
|
||||
uint256 constant deltay1 = 21200291998180703391786627268537370639754717050947726480905414956819686196;
|
||||
uint256 constant deltay2 = 7519842097234401025937885745438092051835648987642577523832118985185758925126;
|
||||
|
||||
uint256 constant IC0x = 14161725605759523184338252532854378215126906936522047246409168349398011687727;
|
||||
uint256 constant IC0y = 837917632681386925505978944501387627840637758492308489030033860784097271127;
|
||||
|
||||
uint256 constant IC1x = 12347231845136841252198959408344579760953930762776335472012558642912341654334;
|
||||
uint256 constant IC1y = 19171139513483996967580448230875620188319909700897784512375502296048645527443;
|
||||
|
||||
uint256 constant IC2x = 14067875738684094281944053855575735897012083426203972726159225916232749549457;
|
||||
uint256 constant IC2y = 2275845745214734226382422221382946829943859650806170719984749746499419122646;
|
||||
|
||||
uint256 constant IC3x = 13144337137521117862571448171413692953272269454891820105935278326824551706366;
|
||||
uint256 constant IC3y = 262118186113269485190756037777167410239882745258249323793003449268654417508;
|
||||
|
||||
uint256 constant IC4x = 12204744666289903951526868110974232682643232552903218195746966666670285159231;
|
||||
uint256 constant IC4y = 8333271752763069437085559853880223771975634232782370100773485883838952236719;
|
||||
|
||||
uint256 constant IC5x = 13337044066374677055615684697251703142670814227997788768876947133048172678335;
|
||||
uint256 constant IC5y = 14836301376817803130178536497684104286777025733292005093458227271524268164452;
|
||||
|
||||
uint256 constant IC6x = 12430971709296092138291690094676884214033956103347116825392698594405115184176;
|
||||
uint256 constant IC6y = 4600285853814761707915038121892575475811925195020643067895488126442304972796;
|
||||
|
||||
uint256 constant IC7x = 21835898288438000815056860809797197454945453685671865888659632245036021081862;
|
||||
uint256 constant IC7y = 9581511208792791592979755505681613301656918110392711020043989622993405494558;
|
||||
|
||||
uint256 constant IC8x = 805048910055413108327316148251287711567012227448270270603250182464903000242;
|
||||
uint256 constant IC8y = 20074388568656682098432209969459017015605463657904728602885213084046977163305;
|
||||
|
||||
uint256 constant IC9x = 16603785429889707164696562579480343919608269697205974338602411546257931980657;
|
||||
uint256 constant IC9y = 2525282044694247624372015399155813089691685312939808682970970552732990267575;
|
||||
|
||||
uint256 constant IC10x = 21726809186654514046952701573776111688759687935855648238033143799314666127357;
|
||||
uint256 constant IC10y = 4421175777305836974862127954629146480579634535616690255252116048035769400704;
|
||||
|
||||
uint256 constant IC11x = 7902686895423588535160755489164237816127687765689748043429686960747514583725;
|
||||
uint256 constant IC11y = 15061872182123925908418035840832020702482627478746432814295888447105500891543;
|
||||
|
||||
uint256 constant IC12x = 15962004717152841646896468179118617364748031797831561293388300015605373353670;
|
||||
uint256 constant IC12y = 14891103606452632568227506711859087518728225440432109964732888022737022937040;
|
||||
|
||||
uint256 constant IC13x = 3632514804452650009630346876088907842909009567747380771589073025451219233531;
|
||||
uint256 constant IC13y = 6410817454552082880367361294399397706087271589838821710119906822444215429260;
|
||||
|
||||
uint256 constant IC14x = 7783626269188411391019409614602541568639684005144846483698219167865789854866;
|
||||
uint256 constant IC14y = 5515347137991370993755350181574701633769722098126338618325345482717941539097;
|
||||
|
||||
uint256 constant IC15x = 21340638595467523972715551097538060415231675418665135934122577583589799345284;
|
||||
uint256 constant IC15y = 6711902293140999424944529553034720017045491076338579799330069153343751805291;
|
||||
|
||||
uint256 constant IC16x = 20493149719068229244879507809911942603120475200216593650840212396018823777267;
|
||||
uint256 constant IC16y = 7301667689402372735905828428111586010034839295668745301104045091666812804411;
|
||||
|
||||
uint256 constant IC17x = 13420106429953696018789010648266870737006484386783872331167574526625395352254;
|
||||
uint256 constant IC17y = 20794037500887742095696051789165620698467473232217129126628967017579782320297;
|
||||
|
||||
uint256 constant IC18x = 12607927365422734904661901421400763601004026940711232636963643829561190773684;
|
||||
uint256 constant IC18y = 8703962251906561389135627251159668903419340382875686740777574778695814605108;
|
||||
|
||||
uint256 constant IC19x = 4949904196754768205196891357571671844458029197189818649914332420920937394735;
|
||||
uint256 constant IC19y = 11973737628254663948504990512778609112229260714375161069097590912391033950290;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[19] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))
|
||||
|
||||
g1_mulAccC(_pVk, IC5x, IC5y, calldataload(add(pubSignals, 128)))
|
||||
|
||||
g1_mulAccC(_pVk, IC6x, IC6y, calldataload(add(pubSignals, 160)))
|
||||
|
||||
g1_mulAccC(_pVk, IC7x, IC7y, calldataload(add(pubSignals, 192)))
|
||||
|
||||
g1_mulAccC(_pVk, IC8x, IC8y, calldataload(add(pubSignals, 224)))
|
||||
|
||||
g1_mulAccC(_pVk, IC9x, IC9y, calldataload(add(pubSignals, 256)))
|
||||
|
||||
g1_mulAccC(_pVk, IC10x, IC10y, calldataload(add(pubSignals, 288)))
|
||||
|
||||
g1_mulAccC(_pVk, IC11x, IC11y, calldataload(add(pubSignals, 320)))
|
||||
|
||||
g1_mulAccC(_pVk, IC12x, IC12y, calldataload(add(pubSignals, 352)))
|
||||
|
||||
g1_mulAccC(_pVk, IC13x, IC13y, calldataload(add(pubSignals, 384)))
|
||||
|
||||
g1_mulAccC(_pVk, IC14x, IC14y, calldataload(add(pubSignals, 416)))
|
||||
|
||||
g1_mulAccC(_pVk, IC15x, IC15y, calldataload(add(pubSignals, 448)))
|
||||
|
||||
g1_mulAccC(_pVk, IC16x, IC16y, calldataload(add(pubSignals, 480)))
|
||||
|
||||
g1_mulAccC(_pVk, IC17x, IC17y, calldataload(add(pubSignals, 512)))
|
||||
|
||||
g1_mulAccC(_pVk, IC18x, IC18y, calldataload(add(pubSignals, 544)))
|
||||
|
||||
g1_mulAccC(_pVk, IC19x, IC19y, calldataload(add(pubSignals, 576)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 96)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 128)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 160)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 192)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 224)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 256)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 288)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 320)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 352)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 384)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 416)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 448)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 480)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 512)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 544)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 576)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,86 +27,86 @@ contract Verifier_vc_and_disclose_id {
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 16428432848801857252194528405604668803277877773566238944394625302971855135431;
|
||||
uint256 constant alphay = 16846502678714586896801519656441059708016666274385668027902869494772365009666;
|
||||
uint256 constant betax1 = 3182164110458002340215786955198810119980427837186618912744689678939861918171;
|
||||
uint256 constant betax2 = 16348171800823588416173124589066524623406261996681292662100840445103873053252;
|
||||
uint256 constant betay1 = 4920802715848186258981584729175884379674325733638798907835771393452862684714;
|
||||
uint256 constant betay2 = 19687132236965066906216944365591810874384658708175106803089633851114028275753;
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 18101353739435763583590109265110793715384414747647041946588945262712539762455;
|
||||
uint256 constant deltax2 = 18140067426412244320277829063813054858080687280648458473373333737751084553574;
|
||||
uint256 constant deltay1 = 12100583937504701276222912703016580653535981028073960895687849861510607959790;
|
||||
uint256 constant deltay2 = 15548750702110684372424236883290507077807106197064669968534467455581942483787;
|
||||
uint256 constant deltax1 = 16844304914544206633570561761027148884941932611757292912007896382077100268910;
|
||||
uint256 constant deltax2 = 5317032611889952964986884162630370682494245917371257174741428596650708627427;
|
||||
uint256 constant deltay1 = 17672834115105671249057453396651777199406039770352867798606833555779180975294;
|
||||
uint256 constant deltay2 = 16550121320029635161714685943187905842339715751867587658369965347212135477854;
|
||||
|
||||
uint256 constant IC0x = 19296243113452192424924855933310697996822768538948987613326131801074651999490;
|
||||
uint256 constant IC0y = 16771331152147825421723855311935089253485924413230282229849393808710818180827;
|
||||
uint256 constant IC0x = 3063892752580393445351912389462972315890804098703268907764093846143370118620;
|
||||
uint256 constant IC0y = 338898849216056337039782474551419657442556214016589819494522848974041783478;
|
||||
|
||||
uint256 constant IC1x = 3653595283879325630602479535989458991160097061510070728166156259221962074187;
|
||||
uint256 constant IC1y = 10790371381373660294141465198779172490985130920747984818722525665122076190000;
|
||||
uint256 constant IC1x = 6940512344612378275596355639005034678720059474894564045852719617049526670592;
|
||||
uint256 constant IC1y = 7271317249041914428407540854687811589115239252968211380262637546965156254207;
|
||||
|
||||
uint256 constant IC2x = 2931995820745069612683985494113971152622087465000319255950328786395435877093;
|
||||
uint256 constant IC2y = 9035944498664226606544286164575756066313390474272896327299084941139202515370;
|
||||
uint256 constant IC2x = 3314486677771826005478629497878600453502704803604117634088504028781562260182;
|
||||
uint256 constant IC2y = 1459013185406293898811099700625611314842810760325719700639326068324009385596;
|
||||
|
||||
uint256 constant IC3x = 19010813103852088139798709832239279855790983757833527758700283802157404140503;
|
||||
uint256 constant IC3y = 14008150425033364435320453632309224439417752598349034283075220373237163033926;
|
||||
uint256 constant IC3x = 21339354103630425157547151549834296358105146168981889077698894723212845838566;
|
||||
uint256 constant IC3y = 1502070405736269547167924944653885169736140888189355495638232415069862575598;
|
||||
|
||||
uint256 constant IC4x = 6464359427916782396404681423925138405662338444504458805039588445789447826724;
|
||||
uint256 constant IC4y = 5585341935263792863088946484145858730139922354691100975034188575464035021389;
|
||||
uint256 constant IC4x = 14396426832793031310666335220247337038928200466826171891279598291110797062739;
|
||||
uint256 constant IC4y = 13835629778228014281391775241314472918522406202606518031388221683433169763950;
|
||||
|
||||
uint256 constant IC5x = 16264441302193298499043740097364654859751453382241589793410301994926243309771;
|
||||
uint256 constant IC5y = 19345900825912255640810072072146945409110534123970248227352776819088110853912;
|
||||
uint256 constant IC5x = 7695555391914963992082972585044820108938489634468335855895726466800632339079;
|
||||
uint256 constant IC5y = 8190077539285758088627521485228441232649488415444971100428498049840976226761;
|
||||
|
||||
uint256 constant IC6x = 16506208098897464444990121675692030098776720539494167369199350253772929517864;
|
||||
uint256 constant IC6y = 5747938518974307274998934485639632806343833887133816517015710818981126395004;
|
||||
uint256 constant IC6x = 2417278349200277234395537419160662854805515444384573884365149909329785767036;
|
||||
uint256 constant IC6y = 10967597226655782922172816985654148489973967823132770447428170201506876668600;
|
||||
|
||||
uint256 constant IC7x = 2238681638455471055829578822399127720012595667722656096829214064981745670869;
|
||||
uint256 constant IC7y = 15764057702299002520178408967012502598351293871423340203313391972878844796961;
|
||||
uint256 constant IC7x = 20295352631233733875881528965574700292586915911951616910462312161657295185313;
|
||||
uint256 constant IC7y = 20082302768596838216870403751325135105630414436618584815984398612522291508765;
|
||||
|
||||
uint256 constant IC8x = 15932395283201177466442402942415301957898109931013192561782982972852241691721;
|
||||
uint256 constant IC8y = 2081729349237280396718318832990678238019489184626940260804732888455547174399;
|
||||
uint256 constant IC8x = 11059827409898927086744943143248537120981080541595077451819524689731328313055;
|
||||
uint256 constant IC8y = 20944806256306983934313871670023039619806058515124706251817080000146458395831;
|
||||
|
||||
uint256 constant IC9x = 17246464275470462932021159163262315320127213201972267468737112319074389329731;
|
||||
uint256 constant IC9y = 13509368513338941479204957377881720321823690944655664118221707796204864855279;
|
||||
uint256 constant IC9x = 18259578827946459664607509870902194427526962214477984213929784003451127220094;
|
||||
uint256 constant IC9y = 21007858375090063424404486960612952186095225779804513006019450439527240860763;
|
||||
|
||||
uint256 constant IC10x = 3529976987798952083700509403394048201827505711672900780512866839528720602180;
|
||||
uint256 constant IC10y = 1175068381227513628750176437001431671552694557874397757299109061361439337883;
|
||||
uint256 constant IC10x = 12982483613179961834997686044638693151117200865260657581197810866310575092501;
|
||||
uint256 constant IC10y = 881050844966282182331005719786290913799458655589383180589908624858220859602;
|
||||
|
||||
uint256 constant IC11x = 11744132562080022492567472652424099627828345514305579053801999033593090208854;
|
||||
uint256 constant IC11y = 17163824415869121360389506887612363794446528617703212852652455519927630378243;
|
||||
uint256 constant IC11x = 11841059290702184133575026782423678355552249188591233355680911506042852172793;
|
||||
uint256 constant IC11y = 21162685042783600449151295113027715814961611113193595910359022152766997832698;
|
||||
|
||||
uint256 constant IC12x = 10512569210323709103965694190194535925579460061173603554047811832253237064445;
|
||||
uint256 constant IC12y = 9133235164595701016006773136643818513149952700317402791175651663293047907200;
|
||||
uint256 constant IC12x = 14775614741163273375675559595724692959987623649519993915008330984244882193158;
|
||||
uint256 constant IC12y = 7287309786402623463914647044896199277350925828035868765984073573672653028741;
|
||||
|
||||
uint256 constant IC13x = 14096670940648536823284106261043909074114582425994949795940951761080669567383;
|
||||
uint256 constant IC13y = 6672936920865870182352778579130923522764995592621615001422332702440354904815;
|
||||
uint256 constant IC13x = 17996181553752736816877495333540760200848413454433427091821989699950376553849;
|
||||
uint256 constant IC13y = 796667563767138218966273387445927104314872470366395704215052203609704727590;
|
||||
|
||||
uint256 constant IC14x = 10137965082386312343998582217112957990397750154401448195043210996745980297476;
|
||||
uint256 constant IC14y = 20665965268686388745453347902051675012719790040992548915780862070073525648412;
|
||||
uint256 constant IC14x = 16069904141003091209542236685411561248720682567234042060289476902937954168846;
|
||||
uint256 constant IC14y = 158923544116241905975145642791234471241344480125334901482809895066319556743;
|
||||
|
||||
uint256 constant IC15x = 12530722223497031400834132734220149467627216717351170844802409015432675184062;
|
||||
uint256 constant IC15y = 16542446169192185598257895867773852412790638192773724178160496977232117853898;
|
||||
uint256 constant IC15x = 15596493027697592322862621020343577229490713781917504414161395671723032987373;
|
||||
uint256 constant IC15y = 3197667355446945179759515532025053591979018955754978250444717842400175295359;
|
||||
|
||||
uint256 constant IC16x = 2935901644122525929795935496871810371309055504379577164301779676669272761627;
|
||||
uint256 constant IC16y = 11495678697136282463089051158589610488213413237729871619083312878306933119756;
|
||||
uint256 constant IC16x = 17557830129416623434101866717763963360406031535965420927807273907570290242676;
|
||||
uint256 constant IC16y = 6371040553725937017356304924377900009836693409950628837714053387420159017375;
|
||||
|
||||
uint256 constant IC17x = 3140949415903027147250907133247775515188280246682612979954129543260668993464;
|
||||
uint256 constant IC17y = 17780575339356448921747528866474435904948144354613637774978360642667726811957;
|
||||
uint256 constant IC17x = 5038594046636670102389675511742083125240656824016073907356961248956227939717;
|
||||
uint256 constant IC17y = 14539719964108900696075513251178141053421038041902227039252320419763540194611;
|
||||
|
||||
uint256 constant IC18x = 17210861851078129942094207819592580654327666889667849825672227467180086498803;
|
||||
uint256 constant IC18y = 4180787430581876644886868782171571145851434462737551567878987473785192088700;
|
||||
uint256 constant IC18x = 4952500289282302627801848690727935795511793886005474219488896581408334483093;
|
||||
uint256 constant IC18y = 8796843519751719503761110444663819947854438782165943987407121035538950691435;
|
||||
|
||||
uint256 constant IC19x = 4013588777574347336950306556469442657948458670943087732631762954689065422478;
|
||||
uint256 constant IC19y = 19548932405358697357691307401022714177949934727272276392590540755844899119422;
|
||||
uint256 constant IC19x = 13731439507080021495215595857175269055764927612142850684078801622411342275350;
|
||||
uint256 constant IC19y = 19085879932964958674918865953232234377473750799460607959620845505827980217557;
|
||||
|
||||
uint256 constant IC20x = 14488298009270040796731390116992032453038332814234613353070613811711837220667;
|
||||
uint256 constant IC20y = 12994202636175510836807126291634980693356658097859608809378904384302651539915;
|
||||
uint256 constant IC20x = 8793709658593232701114904582923462042255230746531689399326462538019654025830;
|
||||
uint256 constant IC20y = 9989838999668941891429039469156478584536258352030342625130247987149197946833;
|
||||
|
||||
uint256 constant IC21x = 2264174571187610073725254809697046066316081283567712483614790422206657895224;
|
||||
uint256 constant IC21y = 5443261565731924397842118569205602979933884113538592419591524392404451555280;
|
||||
uint256 constant IC21x = 676844696708175103867928084644306821721607317685940578024847691931023536528;
|
||||
uint256 constant IC21y = 11885123204508583782566663285179960785847704457876172589471067752544774891960;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha1_ecdsa_brainpoolP256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha1_ecdsa_secp256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha1_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_ecdsa_brainpoolP256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_ecdsa_brainpoolP384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_ecdsa_secp256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_ecdsa_secp384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_ecdsa_secp521r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_dsc_sha256_rsa_107903_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 21859155299301998653429875048978439748236271451496979988343849431031583916392;
|
||||
uint256 constant deltax2 = 5827304101516278761798867504703571373284929931933847951694308188783033146610;
|
||||
uint256 constant deltay1 = 2050897226585007966098797571849238506373622039012073027349420201254089742747;
|
||||
uint256 constant deltay2 = 17726365860179169914340693375052448998767384321575814447957928126939233645426;
|
||||
|
||||
uint256 constant IC0x = 6559173092613386060168935270854349182105520291336674452866314685997255666624;
|
||||
uint256 constant IC0y = 16570004822507871291462200848730202526574002465994697128629601325186320176321;
|
||||
|
||||
uint256 constant IC1x = 16048284565216051296022974956924216859389331933848547701404192860194249535693;
|
||||
uint256 constant IC1y = 15934602679293497982082079208751899247820486680031480323926005601459843658705;
|
||||
|
||||
uint256 constant IC2x = 324209212599366244640837740326034562689971815412923764945442607159540736894;
|
||||
uint256 constant IC2y = 7476376002078162979060395586971013637961805079294862495587486401069332909375;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_dsc_sha256_rsa_122125_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 7062063111115426920080873970463628628158970841742391765359511371460310733411;
|
||||
uint256 constant deltax2 = 15807174084294290354673624584303259430674047734272209934296142996665543184383;
|
||||
uint256 constant deltay1 = 5041341803962582350157313150792213469090025162007968864158643942055389699530;
|
||||
uint256 constant deltay2 = 12448508576685029419552252012019196745666674144346731490404571630846734152007;
|
||||
|
||||
uint256 constant IC0x = 26464880532379524872647926061598409813843336265534416536522859446451528555;
|
||||
uint256 constant IC0y = 3652095281047466394743617224890840011513545213467732366150900715040534699179;
|
||||
|
||||
uint256 constant IC1x = 19509878951167588446304223368853751478491246919700746257541944146286450365250;
|
||||
uint256 constant IC1y = 7724209271895193030487404476524225840664222131605493584385763100003011224319;
|
||||
|
||||
uint256 constant IC2x = 9380543205720183177987789286666924700351692897367035491792019760984396693897;
|
||||
uint256 constant IC2y = 11973710156710086602050984879218870324202266407457000936881528070143132574086;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_dsc_sha256_rsa_130689_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 17503312704695651986215892187718414753100666848819836535139783666450850762110;
|
||||
uint256 constant deltax2 = 9465946312007028459529332509218743305602028585566318888964877615656134394993;
|
||||
uint256 constant deltay1 = 18349179146582609481858450161468521972295083057462330542900918234212961822246;
|
||||
uint256 constant deltay2 = 21328910381398955945399159203648614632729853592912276564839796396574666342329;
|
||||
|
||||
uint256 constant IC0x = 15581107264367286829044550679112326638653346847148427158566743326084967369181;
|
||||
uint256 constant IC0y = 16594142801220876231987007439603724892736233123144169952348923903251106369592;
|
||||
|
||||
uint256 constant IC1x = 19509878951167588446304223368853751478491246919700746257541944146286450365250;
|
||||
uint256 constant IC1y = 7724209271895193030487404476524225840664222131605493584385763100003011224319;
|
||||
|
||||
uint256 constant IC2x = 9380543205720183177987789286666924700351692897367035491792019760984396693897;
|
||||
uint256 constant IC2y = 11973710156710086602050984879218870324202266407457000936881528070143132574086;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_dsc_sha256_rsa_56611_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 15544671786131517901173941557520106325226307553192615999445851967650186307784;
|
||||
uint256 constant deltax2 = 12704323220774756824827171880907121535608261227600779461562005981386231533523;
|
||||
uint256 constant deltay1 = 6511552227119744034484916477398394912508905847234238718530952925614897613229;
|
||||
uint256 constant deltay2 = 16671136850093247878839254425363076547580153421354823638245123253200424471097;
|
||||
|
||||
uint256 constant IC0x = 17286542204384486112605734189952472674247643202046679287812104582159083791381;
|
||||
uint256 constant IC0y = 14473678151700924406577081370743567362127652647139264726393370464921861759003;
|
||||
|
||||
uint256 constant IC1x = 15692034038452456309516634270008926752733556955310499571138281588991787473434;
|
||||
uint256 constant IC1y = 2460384386926826803810161764558256506912230218739952331758417846681800273808;
|
||||
|
||||
uint256 constant IC2x = 14424712372043057499605252329907402873748563743331150655022758005340597108056;
|
||||
uint256 constant IC2y = 6116517038496064761241127758910242637133946288068439777844871027558223330053;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_rsapss_3_32_3072 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_rsapss_65537_32_3072 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha256_rsapss_65537_32_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha384_ecdsa_brainpoolP384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha384_ecdsa_brainpoolP512r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha384_ecdsa_secp384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha512_ecdsa_brainpoolP512r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha512_ecdsa_secp521r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha512_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -58,10 +58,10 @@ contract Verifier_dsc_sha512_rsapss_65537_64_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[2] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[2] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha1_sha1_sha1_ecdsa_brainpoolP224r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha1_sha1_sha1_ecdsa_secp256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_sha1_sha1_sha1_rsa_64321_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 8858719639773296385815951953278807694152911273719048288106452321033896551385;
|
||||
uint256 constant deltax2 = 17981003040624724946512418124237252723190710238468223952328425623748055090327;
|
||||
uint256 constant deltay1 = 11146483659413285000783105180926128796043756768954186296986491849600581223470;
|
||||
uint256 constant deltay2 = 10832023090710860724948223483351923364209104879227264002804670418314007193232;
|
||||
|
||||
uint256 constant IC0x = 12150728506947367547359961332424915627387797387204877545105938910422685775887;
|
||||
uint256 constant IC0y = 6363190299079892445535745513169546147323398864462983086638352178971081770753;
|
||||
|
||||
uint256 constant IC1x = 4278537174078955010543989516813803875471377591029230764632166731497135980965;
|
||||
uint256 constant IC1y = 17024137208356794414104680830691468258121055631049270981976943806718297306439;
|
||||
|
||||
uint256 constant IC2x = 3001300598983558367390199346910282603400236531849323385550134826601912975382;
|
||||
uint256 constant IC2y = 21814838205430468546592110039885206978294773397144342730971801018287782512847;
|
||||
|
||||
uint256 constant IC3x = 6769388142135075397139231647338795864669883035232217925744672971934997770389;
|
||||
uint256 constant IC3y = 6515683519781497433900089471903957766054652815595505596868927210451763005954;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha1_sha1_sha1_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha1_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 14190279922125181022978960080639980019776420515411419860844133382022613270885;
|
||||
uint256 constant deltax2 = 636397834518418825449401671671791758085515711100758813885084237524454395505;
|
||||
uint256 constant deltay1 = 10867418941173876719720494291312874121303926097736052348630352417528330069757;
|
||||
uint256 constant deltay2 = 3966455194280524402580954960974488627038469185349748194102799761509282372804;
|
||||
uint256 constant deltax1 = 822158062174740492392638262173726720642568790052207327999547193714979855764;
|
||||
uint256 constant deltax2 = 14577177194781110124368316539094058379152166422408457044000365576141840652339;
|
||||
uint256 constant deltay1 = 9158261412552904481371413262277119119121511659048154973209011540534454211025;
|
||||
uint256 constant deltay2 = 508867027475264838866036037709015067791301963022575398397595371603366782827;
|
||||
|
||||
uint256 constant IC0x = 12549424169777536312794493254383437627272542627214847190918561652575320013838;
|
||||
uint256 constant IC0y = 20997677641719247504304696603717414649155364545594497756116337404077594755851;
|
||||
uint256 constant IC0x = 19579681091133217251719851592653347902247783297068615213075926108207505995138;
|
||||
uint256 constant IC0y = 7290449270020868793255255591631231210145496220939243702233827733825037581355;
|
||||
|
||||
uint256 constant IC1x = 11649247927567371840629000567928966111162534018568034494702973366134070466928;
|
||||
uint256 constant IC1y = 2688308711058321703717613327926760301446206609607158869709321039936465465859;
|
||||
uint256 constant IC1x = 10934403176256033509387653403032187687320196898520508359296178751058274714345;
|
||||
uint256 constant IC1y = 10695176462690892930303679671729513866007080837051465119026165500193464345805;
|
||||
|
||||
uint256 constant IC2x = 12205236554951714841890485722044384206867427673483832637343145778819270571892;
|
||||
uint256 constant IC2y = 18818955995239520245471064325930332746676640132913589855547929584133183110972;
|
||||
uint256 constant IC2x = 17905651308849993483098987817994963212534332226910377010646406382059399475074;
|
||||
uint256 constant IC2y = 5890076659499968778869532658934002681331137211077679723016011544354808371658;
|
||||
|
||||
uint256 constant IC3x = 7570845991894012528979301185197636069733965741463734389351303485977840118761;
|
||||
uint256 constant IC3y = 13798124377026774663632173979000314997672799649105223548347777540978097876710;
|
||||
uint256 constant IC3x = 9310870913301750578172055357893601228843688473077367355135384571619587832256;
|
||||
uint256 constant IC3y = 20441699625044503144020018654702683048186774212373605041041690946592754158125;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha1_sha256_sha256_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha224_sha224_sha224_ecdsa_brainpoolP224r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_sha256_sha1_sha1_rsa_65537_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 12293066394673411932851258217563564711351629727511093091858055708259347299734;
|
||||
uint256 constant deltax2 = 6473219309174682044752263818281458163615920998161324396426798045947712952283;
|
||||
uint256 constant deltay1 = 2490189412118112060206958552115648026936704989056937224134476590612938834671;
|
||||
uint256 constant deltay2 = 9448274921261729644481121245927952145999503066598658701014941793407007375949;
|
||||
|
||||
uint256 constant IC0x = 7493433378359714597876119632792903263397471534783383849232975301351173299478;
|
||||
uint256 constant IC0y = 5322779541294605351142297458486460142299094515152864910588917546720441280177;
|
||||
|
||||
uint256 constant IC1x = 12099034627509894849210850646975682165980756994438007525357738204359985951900;
|
||||
uint256 constant IC1y = 16215658525555900295966060340985898550104970859965368175852536989736604086153;
|
||||
|
||||
uint256 constant IC2x = 13225650345490777915299622899797172573533529526919312637838453497187866985360;
|
||||
uint256 constant IC2y = 8542958399231544859456782913594301061806886079106142042216017440995769987932;
|
||||
|
||||
uint256 constant IC3x = 3876346079039463659359833416125547195266936235399571647136888931951935556997;
|
||||
uint256 constant IC3y = 13427237859113491706765737864884703885895120137726543665460985948924507244387;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha224_sha224_ecdsa_secp224r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha224_ecdsa_secp224r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 16214105827088988564417284852360532327277151897996920133398134833952689455171;
|
||||
uint256 constant deltax2 = 10948374301705695126611549963019680704125203045842400860846711910254232040118;
|
||||
uint256 constant deltay1 = 10234553601500905405593760575821746903672337744621614191148555235662400897896;
|
||||
uint256 constant deltay2 = 12828043932804181738679829452725865824175634915816765244189388912432199953242;
|
||||
uint256 constant deltax1 = 12186754511621986451676100505074591948480818044495620941692899000949745724313;
|
||||
uint256 constant deltax2 = 13773534046698608842434185527256632288057470639094121898217930853296277392716;
|
||||
uint256 constant deltay1 = 14652454211106129185380837007233308318059536394610731200087771886359232506652;
|
||||
uint256 constant deltay2 = 650532003934801561084307607741713036281140255773834446485100180007511673721;
|
||||
|
||||
uint256 constant IC0x = 18470103109436934921135850330814336342432236555448854387531936411278075318902;
|
||||
uint256 constant IC0y = 21322376739803695871973328423960868418777752178065942614102672813487205551657;
|
||||
uint256 constant IC0x = 10201848357143621270182746431078063253102424450988865702408959229842636721839;
|
||||
uint256 constant IC0y = 13327106627865645055913572284990648879793642782691902401646785745281612626624;
|
||||
|
||||
uint256 constant IC1x = 16961614164141432566857374487774507503477570431339612365351788638986493757458;
|
||||
uint256 constant IC1y = 18494600884540923518593279680793755491825837280840362068317992851899008379869;
|
||||
uint256 constant IC1x = 2873383491910187469217188611377124925903704186653176181321996004443825536996;
|
||||
uint256 constant IC1y = 17318105448026949891408531851909351700738644416189545178916807899544889770062;
|
||||
|
||||
uint256 constant IC2x = 10050906384304156000743396446161708662310937002985559989954504332925394897429;
|
||||
uint256 constant IC2y = 2434038175105016301479650242486848398477468614244024196984579890836264438431;
|
||||
uint256 constant IC2x = 14952388188043485476389937363220831549749586720811508637017634007056219997300;
|
||||
uint256 constant IC2y = 15732918769564021895235144331477903127738631639743029201354362625480689024785;
|
||||
|
||||
uint256 constant IC3x = 21253452996157162348109792890187513738019816015952253303963336988247357703183;
|
||||
uint256 constant IC3y = 17863837973338557342390015614768060924248062058957209250301459612449159982707;
|
||||
uint256 constant IC3x = 14153721122350479587719730768196456698166756615686749633916779964807537243360;
|
||||
uint256 constant IC3y = 21408770943459660422917337125144949287562609198391926902972537599201700869702;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP256r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 3880267463005324715191869765133451897904598499316118462985723601732502230188;
|
||||
uint256 constant deltax2 = 11361209654649711752906043704523873539756730538807520439282002853181143018558;
|
||||
uint256 constant deltay1 = 5967651608686022019436419251332080477967130229809139255733548887646558037411;
|
||||
uint256 constant deltay2 = 1778994676912980073573556623904810525113342661768691242655384931229964058785;
|
||||
uint256 constant deltax1 = 11571020062045922946450120432933500415629234278060883748291509867306802416951;
|
||||
uint256 constant deltax2 = 21092927676064705193028422057775526387691356242866496519739191724752961481796;
|
||||
uint256 constant deltay1 = 3936429402363469651745667215878181375934992434623202354243812880451833769811;
|
||||
uint256 constant deltay2 = 18390640318787761973022937463814944759835963352554164465444049682679234444653;
|
||||
|
||||
uint256 constant IC0x = 4413443026364767942929361951106524548738701900888105789002573313000997173104;
|
||||
uint256 constant IC0y = 15850451783627723265828515034100721442529283342298363070956393332701983461138;
|
||||
uint256 constant IC0x = 9585937372880067356884338021580184725076364093519639537028602671619625444378;
|
||||
uint256 constant IC0y = 15197872351817451967879171122850931334653129523646518742365129692510203413301;
|
||||
|
||||
uint256 constant IC1x = 19819172661838303594762706436675815814969353868681712716343574617949833443828;
|
||||
uint256 constant IC1y = 7123868437028633612977924002015329121205619090170382520201787307795680376756;
|
||||
uint256 constant IC1x = 13229012380098117556680510870144048839106147975060511368184479426256931572553;
|
||||
uint256 constant IC1y = 6469126827169927225089783901128610139691084736696627745903828767621009599923;
|
||||
|
||||
uint256 constant IC2x = 2042391329959809557729434443547239940158352762379120704231690543344569487335;
|
||||
uint256 constant IC2y = 8878458861782666213989889259975666934541290390807755433353948346573432980432;
|
||||
uint256 constant IC2x = 15669744098032321006540445180819975214171597873471003151319299224131594612685;
|
||||
uint256 constant IC2y = 20760778556451819960142591547855965098125331724238088517566257065022509939554;
|
||||
|
||||
uint256 constant IC3x = 2932679121994856060965892436213017392167954055980486890559399521363748656474;
|
||||
uint256 constant IC3y = 13290494543275167108454614354313456600024712357008941460153156202856393485522;
|
||||
uint256 constant IC3x = 5733383599040731507231356220352030481680653553245733334453229927172155455579;
|
||||
uint256 constant IC3y = 8989812286961563409971728394222765483183181787178270263071641640886148985348;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP384r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 7834940996671936488182329401902452637404891774490841423662884585010385107798;
|
||||
uint256 constant deltax2 = 17531225746890808180297376546399229006891551087992794130597861796788867357573;
|
||||
uint256 constant deltay1 = 3082783421737657108110663130807752622971015883237984871952243639814566134640;
|
||||
uint256 constant deltay2 = 11476751318775676194861437581928647440231963329459279159367795122657199715556;
|
||||
uint256 constant deltax1 = 14285980346575244822172732992017502912624203143948591068818204546325673696708;
|
||||
uint256 constant deltax2 = 20680510109576109656910978867719748832937770131688233295132780467377770000216;
|
||||
uint256 constant deltay1 = 18297768545683455866295387593701668212365140434204603704736773123404336302554;
|
||||
uint256 constant deltay2 = 20529609087852162202616279380815633930948298729832972329088876561829107652502;
|
||||
|
||||
uint256 constant IC0x = 9380929200780190092013258723830854475322806970474356519004496296731759853604;
|
||||
uint256 constant IC0y = 10157029072712675623490400812755829004677796902132361969115312268962076200655;
|
||||
uint256 constant IC0x = 2567399529135305761863363582471809319120387013970825380852512725742322155474;
|
||||
uint256 constant IC0y = 17349574131946913020534246185169761183196173173715413572771930100879909616012;
|
||||
|
||||
uint256 constant IC1x = 777314899845019723184341247780093576506666371577183501314791503152017283854;
|
||||
uint256 constant IC1y = 14854754331935139424233814845931650435076057790203630527254935727349816044264;
|
||||
uint256 constant IC1x = 6604693849360272450149336115389622697349414148602659108166186633651376274811;
|
||||
uint256 constant IC1y = 13034223493503033929122985414530610386017576653743077043341752858930552060766;
|
||||
|
||||
uint256 constant IC2x = 7357177774725954220495427022877117771448396185717599210234208043809413819546;
|
||||
uint256 constant IC2y = 10423726669027419015039434208267619826102588405899289245668276529112082870810;
|
||||
uint256 constant IC2x = 16807831982148958493895603199283533462417901894677003777889409314408178749135;
|
||||
uint256 constant IC2y = 9660893488140270906212123561755625068600589580805430082771712257029775141567;
|
||||
|
||||
uint256 constant IC3x = 19946795670818150971679323340390067062087428644295938929900310764888525943979;
|
||||
uint256 constant IC3y = 21323922073759895282233592030074686665922184983152805074025062920490500737849;
|
||||
uint256 constant IC3x = 14489110478318292799320451304589523178249494056709361187684286729631920489064;
|
||||
uint256 constant IC3y = 12839663521198555205337578650421898104154130655040219303218272526709532604915;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_secp256r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 12963377496664491793264465224357422232744648637031510229771533144717435895011;
|
||||
uint256 constant deltax2 = 6088728162367934573395700967870202472886228848168441769978846287222991378002;
|
||||
uint256 constant deltay1 = 10009472577345186507293769203458652200982680321376522701555699106928740253328;
|
||||
uint256 constant deltay2 = 20233623387123256582798168344900734455128464495976521369922525900119068178225;
|
||||
uint256 constant deltax1 = 7731653115626471638230370818606473474828170092643654591156798804280173262434;
|
||||
uint256 constant deltax2 = 15711028309904136888974003005481971365054056630834282166614968656128700496034;
|
||||
uint256 constant deltay1 = 9178116066346955878930073468583416250625288278463468466318818567518970725606;
|
||||
uint256 constant deltay2 = 3524423563798953192173964377017486484750900648629768220893402285957070609544;
|
||||
|
||||
uint256 constant IC0x = 971157478493724406413818461841266676612074205042441001286668541625982655400;
|
||||
uint256 constant IC0y = 20779660995065901905396448671401617042598340772317426477654451426330706311410;
|
||||
uint256 constant IC0x = 9028254282872157733717842511599829744269436921211336230669599789465894872552;
|
||||
uint256 constant IC0y = 3014562824673744457960497656772989890218472597690184174738705627896675589170;
|
||||
|
||||
uint256 constant IC1x = 19819172661838303594762706436675815814969353868681712716343574617949833443828;
|
||||
uint256 constant IC1y = 7123868437028633612977924002015329121205619090170382520201787307795680376756;
|
||||
uint256 constant IC1x = 13229012380098117556680510870144048839106147975060511368184479426256931572553;
|
||||
uint256 constant IC1y = 6469126827169927225089783901128610139691084736696627745903828767621009599923;
|
||||
|
||||
uint256 constant IC2x = 2042391329959809557729434443547239940158352762379120704231690543344569487335;
|
||||
uint256 constant IC2y = 8878458861782666213989889259975666934541290390807755433353948346573432980432;
|
||||
uint256 constant IC2x = 15669744098032321006540445180819975214171597873471003151319299224131594612685;
|
||||
uint256 constant IC2y = 20760778556451819960142591547855965098125331724238088517566257065022509939554;
|
||||
|
||||
uint256 constant IC3x = 2932679121994856060965892436213017392167954055980486890559399521363748656474;
|
||||
uint256 constant IC3y = 13290494543275167108454614354313456600024712357008941460153156202856393485522;
|
||||
uint256 constant IC3x = 5733383599040731507231356220352030481680653553245733334453229927172155455579;
|
||||
uint256 constant IC3y = 8989812286961563409971728394222765483183181787178270263071641640886148985348;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_secp256r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_secp384r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 6945602649534064864682098286410967276607753287972151546798528024638274635302;
|
||||
uint256 constant deltax2 = 21359381305380506064722165875199327035235158385180069017934779833440621380883;
|
||||
uint256 constant deltay1 = 19967516585521230347177884657015270968213139716528188604770916310526119949147;
|
||||
uint256 constant deltay2 = 5895652543754694691197627392185209331792331333244042966782249256857780676983;
|
||||
uint256 constant deltax1 = 11593628810627347760167165883874834688480792495518674758192393736254848569358;
|
||||
uint256 constant deltax2 = 12033994089781844792035477149148605073263374713901420016163834164540180763786;
|
||||
uint256 constant deltay1 = 14983090193035549316976981977612673886699572053819012365148483986985921320851;
|
||||
uint256 constant deltay2 = 11631634446145145404945080395713711477568154339644829706531087026974151052556;
|
||||
|
||||
uint256 constant IC0x = 21071136351195505180773457731943053850060303076922200889654346961589227499185;
|
||||
uint256 constant IC0y = 2917743627079442256164064878327080289886469576054507965483347543294584109431;
|
||||
uint256 constant IC0x = 5510292421443364485572489735559788057005534993251416129707540464938361440333;
|
||||
uint256 constant IC0y = 9635087366646870083137286748910222852870590097717037961161393612538056766996;
|
||||
|
||||
uint256 constant IC1x = 777314899845019723184341247780093576506666371577183501314791503152017283854;
|
||||
uint256 constant IC1y = 14854754331935139424233814845931650435076057790203630527254935727349816044264;
|
||||
uint256 constant IC1x = 6604693849360272450149336115389622697349414148602659108166186633651376274811;
|
||||
uint256 constant IC1y = 13034223493503033929122985414530610386017576653743077043341752858930552060766;
|
||||
|
||||
uint256 constant IC2x = 7357177774725954220495427022877117771448396185717599210234208043809413819546;
|
||||
uint256 constant IC2y = 10423726669027419015039434208267619826102588405899289245668276529112082870810;
|
||||
uint256 constant IC2x = 16807831982148958493895603199283533462417901894677003777889409314408178749135;
|
||||
uint256 constant IC2y = 9660893488140270906212123561755625068600589580805430082771712257029775141567;
|
||||
|
||||
uint256 constant IC3x = 19946795670818150971679323340390067062087428644295938929900310764888525943979;
|
||||
uint256 constant IC3y = 21323922073759895282233592030074686665922184983152805074025062920490500737849;
|
||||
uint256 constant IC3x = 14489110478318292799320451304589523178249494056709361187684286729631920489064;
|
||||
uint256 constant IC3y = 12839663521198555205337578650421898104154130655040219303218272526709532604915;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_secp384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsa_3_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 14647749707677061825484828270521002078084696851816855159003536492611528430747;
|
||||
uint256 constant deltax2 = 8813745538853609647064793492288669362311433131270063175397770751384876898878;
|
||||
uint256 constant deltay1 = 16413416196272519078371346598236491510684971462516242801452362131826588875168;
|
||||
uint256 constant deltay2 = 4506812098053361972091251932040502021939203167880179219130069973931185747536;
|
||||
uint256 constant deltax1 = 18323094730735538975464859171985117997940930551982929972225298047084081907295;
|
||||
uint256 constant deltax2 = 15633998802481912650287795263895470165317532829743258017341221493082245210179;
|
||||
uint256 constant deltay1 = 8468682968821593671126649418656827856979906973461667106657793203706424289497;
|
||||
uint256 constant deltay2 = 4802833554776540298196933991716868748258821767445039945445819537596221490303;
|
||||
|
||||
uint256 constant IC0x = 19535292804879143450805104991792162091533263708065254429739061918045694002215;
|
||||
uint256 constant IC0y = 555963194851028634947976262733430994975839744975862271873829630169810483269;
|
||||
uint256 constant IC0x = 7181314110132554839928282037559893045840661818526843455107237948952019674;
|
||||
uint256 constant IC0y = 14829242670077188671656908018121435620612158808908656588982879534468681533553;
|
||||
|
||||
uint256 constant IC1x = 14944148245573413847409949601267778073005632492289423193102954566021611218430;
|
||||
uint256 constant IC1y = 16228591396217950704428928973081485974107311040449825726971652137219878452378;
|
||||
uint256 constant IC1x = 13059462140238377001399826074670535711591096704620802674979057143719556429919;
|
||||
uint256 constant IC1y = 13824573358814826056551030976939968654041517982260212257830983661316546299691;
|
||||
|
||||
uint256 constant IC2x = 7513874658970264046151666460206583318185132845807747388177636551827339940764;
|
||||
uint256 constant IC2y = 16937110561484684552882719605464897239947933444016574090631293203710890399249;
|
||||
uint256 constant IC2x = 11583971220062589401405755740664790220355287278292783839758599878547437533978;
|
||||
uint256 constant IC2y = 10006212822838085138091872398564067803622477443634743780369904845484096894156;
|
||||
|
||||
uint256 constant IC3x = 16899512432516583773062339694790647917131453205275290501891880122952973666154;
|
||||
uint256 constant IC3y = 18344019634966347882500560302241406368945492953620589343628089635995842764226;
|
||||
uint256 constant IC3x = 7053570126214208416009847673779515197202831346883702395012087586745761564125;
|
||||
uint256 constant IC3y = 16679120302598831468868832029459451674888658372567643730511144337433393922345;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsa_3_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 1446007635651001478399416834025361064730904406433587279882989817179915163322;
|
||||
uint256 constant deltax2 = 11029874371203576169927920149438486263788347650898947909097429828744260594009;
|
||||
uint256 constant deltay1 = 19424564492342016166932979920084231745324313528509522440969235572167481083212;
|
||||
uint256 constant deltay2 = 17217433426878481742403985330580044241645051432909572363755201114398124678093;
|
||||
uint256 constant deltax1 = 5925553651051872432520768286850063609673769029376092260284391950521664832978;
|
||||
uint256 constant deltax2 = 18925932716344525915989263012042119007766458743996260462885675773310215153069;
|
||||
uint256 constant deltay1 = 6146490885165480718509809581669313582242514127312118671365653043796237760462;
|
||||
uint256 constant deltay2 = 6177982897227961665874290431566866421413637244534182415247589649795541036682;
|
||||
|
||||
uint256 constant IC0x = 2896975070434144504693718373783930947697452524165610544523948531849390091194;
|
||||
uint256 constant IC0y = 15141405030241059803780301530659100196538339568786584292240704461039500472481;
|
||||
uint256 constant IC0x = 13420220426424942992996126497171659851250008296890467978518676275980130726809;
|
||||
uint256 constant IC0y = 12988402183154204825046595028123635406226755083213453495428984935214083700995;
|
||||
|
||||
uint256 constant IC1x = 8497825819111733137120076255686622884059638285513379316107553067801188707034;
|
||||
uint256 constant IC1y = 8214454200388136429117471764130736997925786390111987072796390258621297811511;
|
||||
uint256 constant IC1x = 15720293028473130494041796294842631364514408686311431308483119533080944071494;
|
||||
uint256 constant IC1y = 8254471651178384507745678062532870935882204458418529694685043039499148219955;
|
||||
|
||||
uint256 constant IC2x = 8117986690876471131912200200824058242898179875892365153798015013348872187830;
|
||||
uint256 constant IC2y = 13728708960125530376527843459996900850247913196403179996980595486604748085009;
|
||||
uint256 constant IC2x = 3536452563101319575820690365071086979565598651586348222093795954437168495670;
|
||||
uint256 constant IC2y = 10957462649391966245526498665561723101999665652595131740749565250494034509213;
|
||||
|
||||
uint256 constant IC3x = 20206076116144865102648336068968188648510089252325407316710566928223313992570;
|
||||
uint256 constant IC3y = 4349322657390806457108392420135421329511502456706611604045100748468997649784;
|
||||
uint256 constant IC3x = 16116021355897933195370104432003944758199218542970019719742388193047811664776;
|
||||
uint256 constant IC3y = 5135784455903892220403944817230953778933184524023563568298873014371592656654;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_3_32_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 15874061924764820323055960254470647945920797618432316166288447077211726457074;
|
||||
uint256 constant deltax2 = 18981518226073544477340631971467848064792552066399371789141351325958605872829;
|
||||
uint256 constant deltay1 = 11864850314451966143977790953310135805365548259058708972755733776499293897873;
|
||||
uint256 constant deltay2 = 21845823234675611488857525737119705943945832555237176427772012151739399710688;
|
||||
uint256 constant deltax1 = 5952935792112386089664075276506574591647565452016400302527327381084070402092;
|
||||
uint256 constant deltax2 = 17335587442682306577951848969748360397013542559654931819546958792245472466291;
|
||||
uint256 constant deltay1 = 9072004951564723074930095158189547201732507465756059444680240886011617441826;
|
||||
uint256 constant deltay2 = 5054541817331983067867577426737187042550404143560324087150861611545973876801;
|
||||
|
||||
uint256 constant IC0x = 864567118995086160743256448257118992082642268653458709197471160347599187528;
|
||||
uint256 constant IC0y = 15192821752449908804348422059394114257923426159574753323932521804412028780506;
|
||||
uint256 constant IC0x = 3370657340393187637962244358807342983205801080325348964443694720133663165732;
|
||||
uint256 constant IC0y = 17504768540319600949672349387511459243890321640865435583996696878741991145530;
|
||||
|
||||
uint256 constant IC1x = 57671318416079122695271302808711271344167339034721790169614290343582266277;
|
||||
uint256 constant IC1y = 8024612677278232881958067943751883680830132562215386088661722458746624855050;
|
||||
uint256 constant IC1x = 11108098375934861257089747981971683089120880603665765176405380630895677693438;
|
||||
uint256 constant IC1y = 21428390854393904060271492851013148255195874493245510962567653333236803597892;
|
||||
|
||||
uint256 constant IC2x = 5893335435951528372739888071420424557944639611296932452570414289189759152790;
|
||||
uint256 constant IC2y = 1640784988141486166702862737374230949507354034300443154367111826297088261402;
|
||||
uint256 constant IC2x = 17263838786974246039147483083406640386112901196000955890450205878844344023162;
|
||||
uint256 constant IC2y = 7172494942286372907894244424972326402670365608208267821793351104370543656195;
|
||||
|
||||
uint256 constant IC3x = 16124128600103934769659464672688183254468286200294662394040691336070615001554;
|
||||
uint256 constant IC3y = 12533244433776905749428396050611553706022674802396935708642924106653328592794;
|
||||
uint256 constant IC3x = 7171502066660640491861308919505387535067485749040400433934975424571250212521;
|
||||
uint256 constant IC3y = 4833790801986384993729574576866506081887308194427976699963678564469539110221;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_3_32_2048 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_32_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 19933372079052971918118887419131447052512110436320533943180129896892768677472;
|
||||
uint256 constant deltax2 = 5696552812125803158275714100358698410291898464719793349619758961586215340032;
|
||||
uint256 constant deltay1 = 3792471680505921396333520909081952315139563411036171858765485247099915343194;
|
||||
uint256 constant deltay2 = 7834577521095710314640304530217848891170143563650920141026510601190572665753;
|
||||
uint256 constant deltax1 = 9829220251670624912165276764991066906071969828919553024297174476113109123356;
|
||||
uint256 constant deltax2 = 1131592679175112352727876325285689057060250869887612608893146802659280777092;
|
||||
uint256 constant deltay1 = 19431854401326895208400591775838267944646680403133366566074599776144027793145;
|
||||
uint256 constant deltay2 = 5555161261226826704479502675380049517006145344748858308766475247726530752166;
|
||||
|
||||
uint256 constant IC0x = 15940233703293529982489124575653602841593850941721676378988264690099813885918;
|
||||
uint256 constant IC0y = 15038727662904663137326945348658821546878788508554440696558141029247183399700;
|
||||
uint256 constant IC0x = 15079765447944439387733586418690281221074336348591288909800652208743319628569;
|
||||
uint256 constant IC0y = 3392930919164350899254498818980041608535063594052708961653642462924353666321;
|
||||
|
||||
uint256 constant IC1x = 4387710504668864775202636693040384302111624636631927312468509697811377999596;
|
||||
uint256 constant IC1y = 3510492898314066303975096238624826722299519115162425599678234843934438662736;
|
||||
uint256 constant IC1x = 1222908395897639289053869659229529437505364235699133382214023931301842376040;
|
||||
uint256 constant IC1y = 2788818457970732505970235155315917685774630096788025737587425914695418398462;
|
||||
|
||||
uint256 constant IC2x = 12521474768794105470899455691021394967155006011883736785890784484945145131923;
|
||||
uint256 constant IC2y = 1911506232809760438055026006064486972732015671494897000361912629401546426535;
|
||||
uint256 constant IC2x = 12121729569450925350557193555998594702635066391374890991366980805523623982122;
|
||||
uint256 constant IC2y = 10092172366528380443721301666616757201731740906360544030235298288396971891;
|
||||
|
||||
uint256 constant IC3x = 20380595518478962939246410562197377800925308605816138717821827613004888748361;
|
||||
uint256 constant IC3y = 19108863021845375561806462885130659634334622294078393230914631297465277164089;
|
||||
uint256 constant IC3x = 12413321860135857043745448829471358871069297926735867865928726377817945813171;
|
||||
uint256 constant IC3y = 20182846585989369311189581126693571255993102059166446771658701764355209373209;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_32_2048 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_32_3072 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 21559408464988768172496882775965159124648891181084168223280963168578932114778;
|
||||
uint256 constant deltax2 = 469504362702284700417991441753024212560451958605799121351471110369282727085;
|
||||
uint256 constant deltay1 = 8014321962863915223803389703715624047926308236051401646943904743146732508983;
|
||||
uint256 constant deltay2 = 11214719314841245971781809190277089749821390304455972238309809087084757267166;
|
||||
uint256 constant deltax1 = 3775036704064955487193587237490678363914018256996846676506676750468739681375;
|
||||
uint256 constant deltax2 = 10273332986040337968712448543431862945542907514803923278475990972063519967241;
|
||||
uint256 constant deltay1 = 2534361246993722992323213445842903316859432608197318447000566994301344715793;
|
||||
uint256 constant deltay2 = 17397733954717951643767653545687065815085153004087643532573039331524772225775;
|
||||
|
||||
uint256 constant IC0x = 4442674288798072192537849082306932965393221163106804572182732099195466306748;
|
||||
uint256 constant IC0y = 9323084270923277411827674864951268428159377569423075778477106053695141773828;
|
||||
uint256 constant IC0x = 4720012618752419424493233025663511658282698115255399538154718766637758118681;
|
||||
uint256 constant IC0y = 14176296453831519940348674405747484147657957028784471933858006838308776354281;
|
||||
|
||||
uint256 constant IC1x = 17475148564773797100951325143542363138470642790727097637149801225083556527948;
|
||||
uint256 constant IC1y = 13224157924895467265046035134109354975304416107586812175973544396078768354587;
|
||||
uint256 constant IC1x = 19768768913354969390560706650174747841369763995953624915184968139436157488870;
|
||||
uint256 constant IC1y = 21862298168663211284275209300393882365640402290983544625655659653828738765603;
|
||||
|
||||
uint256 constant IC2x = 8627292687524930766501122870584322406115764891060607976710023272680188721027;
|
||||
uint256 constant IC2y = 19693251496854233570042048181193912262696708094766804865992303908876954149138;
|
||||
uint256 constant IC2x = 21311637485820278165751144500398665440989697286354418956442103164151266301667;
|
||||
uint256 constant IC2y = 5439898348861181550642699776746189826607068138739113447822371119515637068941;
|
||||
|
||||
uint256 constant IC3x = 16769438230691043401686236120380822596803107947112743541976734726321851500352;
|
||||
uint256 constant IC3y = 18343915073130081511034581688483916276976933356089829231144244959863911944057;
|
||||
uint256 constant IC3x = 2412891617175958976233163585834185390641556899883667068714465945563328227844;
|
||||
uint256 constant IC3y = 2076923903604997960520025304107687504288595338461316874423119237729306335786;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_32_3072 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_sha256_sha256_sha256_rsapss_65537_32_4096 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 4996696888642909188209135052085295835162832379249820882379634723964498535649;
|
||||
uint256 constant deltax2 = 12442087638273372508643781528095496567420048349584165379251412416551053172381;
|
||||
uint256 constant deltay1 = 6232379876472805010942105544407949523696784522271190083307735517189452908756;
|
||||
uint256 constant deltay2 = 17740847193776505605697936862676944544185141284695252023858066922100538888283;
|
||||
|
||||
uint256 constant IC0x = 2228375636255881329898966720153199713866731941770376793460492187546499308731;
|
||||
uint256 constant IC0y = 18483420977146405942257064733829938152351409130549643623712718197805435933154;
|
||||
|
||||
uint256 constant IC1x = 16034521395688998709928709708375958224704655439082288842471593285992282729067;
|
||||
uint256 constant IC1y = 4232952412944080553750678355465403341479367203051438752418681279457104078120;
|
||||
|
||||
uint256 constant IC2x = 14438768989700630908104799913611769670947788874331578348432902989870919780327;
|
||||
uint256 constant IC2y = 12163923886096933685516692842943849379877669363704396493222585917149546874854;
|
||||
|
||||
uint256 constant IC3x = 9377368458072000549360313306943739392398680097418636703620805664176278935794;
|
||||
uint256 constant IC3y = 16774254316544533198984951784594435435958127937061453893553925159662545803944;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_64_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 20350428337215367591531986952739963674340117030832249036188305934419682314738;
|
||||
uint256 constant deltax2 = 11295122461145919557086948725572819088135184260481486850563748944625300910226;
|
||||
uint256 constant deltay1 = 3197755041985442888010495806822501316801567490939517533778517971336617045486;
|
||||
uint256 constant deltay2 = 18078269382736297653475166131146569271615526585244834521359676976562042865246;
|
||||
uint256 constant deltax1 = 255447876653137879856051756619141260297718002823557479890985479932278213513;
|
||||
uint256 constant deltax2 = 7463176375571064718640229763224673881239112306266097928115254972666142959803;
|
||||
uint256 constant deltay1 = 12063863369016200715968674179999669143406520212126949227201331551003526237817;
|
||||
uint256 constant deltay2 = 1349356801259837395290201159599799415046000074031763343541339194612620831529;
|
||||
|
||||
uint256 constant IC0x = 9553458155552612257400405518531837023185695954306259602670575368172832880665;
|
||||
uint256 constant IC0y = 20424846650428124055117899430997530906145349856100668259637953959695204208720;
|
||||
uint256 constant IC0x = 3700345227671421031660357215528972797863918224513548018444034331515482004537;
|
||||
uint256 constant IC0y = 13860331642162919258805009193314707907598483873331179389934157064454042524687;
|
||||
|
||||
uint256 constant IC1x = 4387710504668864775202636693040384302111624636631927312468509697811377999596;
|
||||
uint256 constant IC1y = 3510492898314066303975096238624826722299519115162425599678234843934438662736;
|
||||
uint256 constant IC1x = 1222908395897639289053869659229529437505364235699133382214023931301842376040;
|
||||
uint256 constant IC1y = 2788818457970732505970235155315917685774630096788025737587425914695418398462;
|
||||
|
||||
uint256 constant IC2x = 12521474768794105470899455691021394967155006011883736785890784484945145131923;
|
||||
uint256 constant IC2y = 1911506232809760438055026006064486972732015671494897000361912629401546426535;
|
||||
uint256 constant IC2x = 12121729569450925350557193555998594702635066391374890991366980805523623982122;
|
||||
uint256 constant IC2y = 10092172366528380443721301666616757201731740906360544030235298288396971891;
|
||||
|
||||
uint256 constant IC3x = 20380595518478962939246410562197377800925308605816138717821827613004888748361;
|
||||
uint256 constant IC3y = 19108863021845375561806462885130659634334622294078393230914631297465277164089;
|
||||
uint256 constant IC3x = 12413321860135857043745448829471358871069297926735867865928726377817945813171;
|
||||
uint256 constant IC3y = 20182846585989369311189581126693571255993102059166446771658701764355209373209;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha256_sha256_sha256_rsapss_65537_64_2048 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha384_sha384_sha384_ecdsa_brainpoolP384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha384_sha384_sha384_ecdsa_brainpoolP512r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,10 +37,10 @@ contract Verifier_register_sha384_sha384_sha384_ecdsa_secp384r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 5871020911378373609547663505499774901268992932285986245551973711910141955999;
|
||||
uint256 constant deltax2 = 19144360073660876568729969562756864623454131570445009094595606837687813767236;
|
||||
uint256 constant deltay1 = 18630562029083011749139129416009898557769390926458810249983021246639999227467;
|
||||
uint256 constant deltay2 = 1011109272833598390977539199612944726845021809539574052190091154920112749106;
|
||||
uint256 constant deltax1 = 16013065587655418262036384004613623992566532491045722297486758095504162518134;
|
||||
uint256 constant deltax2 = 454047455240464389457251427929061273725685515861449710366601368293032517063;
|
||||
uint256 constant deltay1 = 9129556927103904469455488785143196171925685986824517956088180176332987868984;
|
||||
uint256 constant deltay2 = 20642448182366560457437976797003227840763621217266716110683318043906434900320;
|
||||
|
||||
uint256 constant IC0x = 3780040829589620961842050296152309027694284035469768109931467383966386453032;
|
||||
uint256 constant IC0y = 20303290878529451916277502376995890431313886134621590119817656908382853847174;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha384_sha384_sha384_ecdsa_secp384r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha384_sha384_sha384_rsapss_65537_48_2048 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha512_sha512_sha256_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_sha512_sha512_sha256_rsapss_65537_32_2048 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 20918103655260648318066617285884017177782214712795905199078585246283006174555;
|
||||
uint256 constant deltax2 = 16858716136883931152810351889936163735305540499259245814206298848552946319368;
|
||||
uint256 constant deltay1 = 9342947644526809530186269184774695129880757199004588785967720163627257925853;
|
||||
uint256 constant deltay2 = 14051627727848294195411378058077236309796119545673864742592429919946100210504;
|
||||
|
||||
uint256 constant IC0x = 20180987531142311296111162163642543192950291098216770625063302093574378279144;
|
||||
uint256 constant IC0y = 8052569077288864742680731223951240163781700479173412854114371971282678064157;
|
||||
|
||||
uint256 constant IC1x = 17481907007618731434791499135680611755280204363448323865726604026226146092168;
|
||||
uint256 constant IC1y = 9642450580361520932294970688970819895203055590682171641407655203207353337686;
|
||||
|
||||
uint256 constant IC2x = 8204439677526769540733096639935534217236489649994538759224638493408350657985;
|
||||
uint256 constant IC2y = 9724102894102516527384307666762181318034061877344399340666397746044105948202;
|
||||
|
||||
uint256 constant IC3x = 69238928030289563361778126309940590892033775507079754601673722675378870270;
|
||||
uint256 constant IC3y = 20476114682373581361925510502099986486869902073770440831483803338135189031359;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,10 +37,10 @@ contract Verifier_register_sha512_sha512_sha512_ecdsa_brainpoolP512r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 2423228640468647612801832231246145599238602575454910973185044878125526999426;
|
||||
uint256 constant deltax2 = 9684736443252839014653748876794179019073917784497423707602799897297208454757;
|
||||
uint256 constant deltay1 = 15371414707011118671181361178964381488465322390746023700386786238047982448231;
|
||||
uint256 constant deltay2 = 8600610256489752478989681639312117511404371259457558379070223496855344280693;
|
||||
uint256 constant deltax1 = 7489054128647107996262165705239509525264981453471831950279104132320943819759;
|
||||
uint256 constant deltax2 = 18261677081952378446367076968435412424379060741613860211979411866488210801931;
|
||||
uint256 constant deltay1 = 5374327510628216011519182077685123230266934287376832439429329939248669490862;
|
||||
uint256 constant deltay2 = 573817352615284844254205899766763417505629772316821759436102825566840291074;
|
||||
|
||||
uint256 constant IC0x = 2073596777521036649670027444059732468457515293188573619301101574675593418327;
|
||||
uint256 constant IC0y = 11729169507389826602031272705690379746423095752200348310305856591367829187733;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha512_sha512_sha512_ecdsa_brainpoolP512r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha512_sha512_sha512_ecdsa_secp521r1 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha512_sha512_sha512_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_sha512_sha512_sha512_rsapss_65537_64_2048 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_aadhaar {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 1184175006002790631176821634090938467107330227007158853824891629496015889924;
|
||||
uint256 constant deltax2 = 12086636205582787465813058141825079064824697543086779109775595053805081617827;
|
||||
uint256 constant deltay1 = 4456837667197728326322115376478122146150647259307011732553476664405503785753;
|
||||
uint256 constant deltay2 = 9088696651190771223855139438876954166862164661620992858425695135876196457926;
|
||||
|
||||
uint256 constant IC0x = 6547380589242664979389953612506618657067204598675122139604885565320676833158;
|
||||
uint256 constant IC0y = 19055399919951028177234969337049077818155869440497248883170998389487338107126;
|
||||
|
||||
uint256 constant IC1x = 20557545828033851521979343305884318041481443328161582179150888164584749744669;
|
||||
uint256 constant IC1y = 21560118189953885636148717201222479281100786469743463492679572665614931385205;
|
||||
|
||||
uint256 constant IC2x = 17559551632997878871440402139938294429514970824368869332125462241643052815376;
|
||||
uint256 constant IC2y = 18428425902276807983388946110037886804676016275275246286544615654725514849838;
|
||||
|
||||
uint256 constant IC3x = 18768989044514693938417600792629717603460465495191187242290958821278680606604;
|
||||
uint256 constant IC3y = 6584358559179261704032830455997936799129839324733806160004605275139747821694;
|
||||
|
||||
uint256 constant IC4x = 16692378542219000347024593964346873649905710163948976095790586330709671710647;
|
||||
uint256 constant IC4y = 2622311591517607336391164955074698243697841582935873217110527812716210930596;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[4] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
g1_mulAccC(_pVk, IC4x, IC4y, calldataload(add(pubSignals, 96)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 96)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha1_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 2610140474269564529536901363015856032355328531503459581395566908588568319109;
|
||||
uint256 constant deltax2 = 15318718846702721709617081040512294190650405816088035822291612072546229310115;
|
||||
uint256 constant deltay1 = 9696224472291361949823496417968126662388078987562773419395836097186992262650;
|
||||
uint256 constant deltay2 = 20557080238513985280864867498953090567206397670381711611626854370917371535619;
|
||||
uint256 constant deltax1 = 11650793587153640920677743015512200903336265476819090557773010769912104904728;
|
||||
uint256 constant deltax2 = 16014592082466979192399382986920416350632584336369862370970229668076988911657;
|
||||
uint256 constant deltay1 = 16394365745829286379334377513140887718174438908750498637524821116102985719467;
|
||||
uint256 constant deltay2 = 10316069577644115982545213966765201062147109986130735906276696521242086652443;
|
||||
|
||||
uint256 constant IC0x = 12782664575876948461634985208844131806824514202593217192976811202857989528195;
|
||||
uint256 constant IC0y = 6272044048986429359609326727070206339637913909189751375907775516261432242989;
|
||||
uint256 constant IC0x = 14287140687558801106294983907149799943175317998808780569458294747845282609458;
|
||||
uint256 constant IC0y = 18090648992440965765650122953402292873176917778496965518955727647572055022720;
|
||||
|
||||
uint256 constant IC1x = 15587351005048079403259805758735528077850790001908402598563282841965686988011;
|
||||
uint256 constant IC1y = 3734297227865929350411672278236171164932747235627416464635029261784011978829;
|
||||
uint256 constant IC1x = 8025518545526506673264072746490343849379148801637033898036291727796840182587;
|
||||
uint256 constant IC1y = 1804400097720945739638405924752919475940194492033609508148766600038219310826;
|
||||
|
||||
uint256 constant IC2x = 3192527152349646569287042803597997491640282817333930333945627955917425296211;
|
||||
uint256 constant IC2y = 8510947012392944324753331923966986873560815579309620640559531931691381848696;
|
||||
uint256 constant IC2x = 11377312211346371285030629785350924072728216446400200033557459847663076243497;
|
||||
uint256 constant IC2y = 12449599553428535596185393396595122933166089086451987746125279315053898366351;
|
||||
|
||||
uint256 constant IC3x = 7875209472349320699246391586475753847475218182263506828375836907878058236692;
|
||||
uint256 constant IC3y = 10393938413743493204847444808907295192374702282726967544093431584963360859545;
|
||||
uint256 constant IC3x = 12568888396711631952441325458114393918993475407672153949176221219672535349782;
|
||||
uint256 constant IC3y = 16076269881424978753636638009617851897033027278209844878999869086308309114980;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha224_ecdsa_secp224r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 5802949227168925196947801208546878734687377773709835863216808460992703031961;
|
||||
uint256 constant deltax2 = 6193855258342273338118170615823833995233364737350101766639283205662848188156;
|
||||
uint256 constant deltay1 = 2817117441823937581358663995690062146792111355184479703938443028411502375684;
|
||||
uint256 constant deltay2 = 16928236998864911959396120268296841397568788662820079785080616877814572300071;
|
||||
uint256 constant deltax1 = 18081614177243771457792759503441100015631421640025815514874948955400668145745;
|
||||
uint256 constant deltax2 = 21212963885909384588328900533785113739308583625159961857663873398824228868829;
|
||||
uint256 constant deltay1 = 11730448187569786839221805976091612115423518589159876788285141561950594574159;
|
||||
uint256 constant deltay2 = 13658050920437017609358049392903964004508133800946087098612553275255623423506;
|
||||
|
||||
uint256 constant IC0x = 11374636014258287989542736865714480611956548785342021908192231719122138435331;
|
||||
uint256 constant IC0y = 18634577350753749992518234474569659802359252701260656178083935152737462603046;
|
||||
uint256 constant IC0x = 20580812507876642641123585136980073354865570761314739472969521817827463093201;
|
||||
uint256 constant IC0y = 9808983900828872217230750786413244164781650244509585885284868587838736423240;
|
||||
|
||||
uint256 constant IC1x = 4877104892963964510602389863264525433911013944037639129481230915482545288643;
|
||||
uint256 constant IC1y = 7318664337220351241336347753464859224490071554341626799580820538045865274156;
|
||||
uint256 constant IC1x = 2752726112045477928969060287725218185128115099870577729261793452249090745554;
|
||||
uint256 constant IC1y = 16495987149635419301634406244137194559654819259536525346111097840177155261812;
|
||||
|
||||
uint256 constant IC2x = 6900490878146153921099201023775874453716286682380018713010149094002979432879;
|
||||
uint256 constant IC2y = 20026188477309485500235567984438387405752112548074418138830975097222450303315;
|
||||
uint256 constant IC2x = 13402737482299579319511431375463559933293373962028793515927350559840480046047;
|
||||
uint256 constant IC2y = 21712434076319308129785504568849678247225727017351700508560824178486431911843;
|
||||
|
||||
uint256 constant IC3x = 9154937524330247502862998558230341981276615002716286336849211363823600043578;
|
||||
uint256 constant IC3y = 3044640491817643422736799203110699377132921638044471745254381893840878063988;
|
||||
uint256 constant IC3x = 17997440361141586090831744070854497684031087644478993394530417140699120810981;
|
||||
uint256 constant IC3y = 12364061735358431984473011030688912826449957212066275614022570759678604252617;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_ecdsa_brainpoolP256r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 2328901728124685246614212080329299833153447022260412541980176366308938284567;
|
||||
uint256 constant deltax2 = 20471098430670406273938182997884966755446838599713149502268319445903313113421;
|
||||
uint256 constant deltay1 = 14470754108546528215639497620462346596483780792881472677814536641495824979690;
|
||||
uint256 constant deltay2 = 3866971914385074197265402137367019872818051107393754015548058893966103402468;
|
||||
uint256 constant deltax1 = 4023989492497160932996619545337579058413331836584673663921715138273937390592;
|
||||
uint256 constant deltax2 = 15019936043240211088246163108260202078279863106058660135805321304889948520027;
|
||||
uint256 constant deltay1 = 17834463815636918340260269455618279637698418910995916105742295052153113069179;
|
||||
uint256 constant deltay2 = 1640634867391701665857182037048034272436418178681480941505135615958458305057;
|
||||
|
||||
uint256 constant IC0x = 11461638649106936647640336770239363341758214410920422533166232685418218264912;
|
||||
uint256 constant IC0y = 17994465386599073409956804415684845012040104617262839741854325241465817751436;
|
||||
uint256 constant IC0x = 19202839351458572187412650155204158265406727106843815600027663945100043987795;
|
||||
uint256 constant IC0y = 16659415014707740301388092175139252273549056229347327753048724556568548763220;
|
||||
|
||||
uint256 constant IC1x = 206924806773489186391212726584921916956610409477734208211742885188096591592;
|
||||
uint256 constant IC1y = 14374660937126324285115101145080473686748050880419214970461818849525315934198;
|
||||
uint256 constant IC1x = 15433426941796597560866672905690806069931422920027577317109747871771173589967;
|
||||
uint256 constant IC1y = 2570809804089172151434494437147672351277328467570191757621922811012669134667;
|
||||
|
||||
uint256 constant IC2x = 7297516874066837353335283393154280635608227716206858128773881457783462063640;
|
||||
uint256 constant IC2y = 4808834262795305139994582189568869698603398227598314116544415406134565415410;
|
||||
uint256 constant IC2x = 17004568555968529409726968653096199685247402293900109814387849940736990177656;
|
||||
uint256 constant IC2y = 13634587981919205862814197837050548541811391384265429714804418288958233253897;
|
||||
|
||||
uint256 constant IC3x = 19834510226948364257345434586235668518759040232058336504629203488016257053543;
|
||||
uint256 constant IC3y = 20150414611910167042901912653944906728052743015541319164045752952411517227280;
|
||||
uint256 constant IC3x = 13097759433387201741580981570212924654332086726192430780118201722414691137761;
|
||||
uint256 constant IC3y = 7845209344779415505874244383404703477754343670972551406959872660872359550923;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_ecdsa_brainpoolP384r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 13910519161763815308553022288861669203637747561663884691891439961121313262839;
|
||||
uint256 constant deltax2 = 6677045486767314362636545964084571187856991678873046712337937315040159499430;
|
||||
uint256 constant deltay1 = 13686042123792277948128076122260606813843656541652941618410924556869698862280;
|
||||
uint256 constant deltay2 = 17276825180637912594687111621219190449394753766841797041991521343372157765141;
|
||||
uint256 constant deltax1 = 19901917574920960392395425873450541464954438929554096284393292348744572711919;
|
||||
uint256 constant deltax2 = 19138721599855432801823463708998213411551487141654396163738981610961280344376;
|
||||
uint256 constant deltay1 = 12780978806977341890821650684496577273631790873786030535686894410726801453393;
|
||||
uint256 constant deltay2 = 15435305615977701014374315582234746763460823891716433906781676104776709631477;
|
||||
|
||||
uint256 constant IC0x = 14160415025640250948390171801701624887675802009615563850409162472512106874200;
|
||||
uint256 constant IC0y = 19587503702313430416935361770089144956260908110203693437786482209328877860231;
|
||||
uint256 constant IC0x = 10763548958482235156915232777201764988378941347175137291594258718511010496368;
|
||||
uint256 constant IC0y = 1564780371889224165695573357541352087868434871602828075588338786874229611538;
|
||||
|
||||
uint256 constant IC1x = 16513226802075774073375414771053364987093921898138799627913632739002024706670;
|
||||
uint256 constant IC1y = 17442079741536153386809804237448908691035302979393670963773738427936297801452;
|
||||
uint256 constant IC1x = 4325501697698861663481351488454220785573099665143108391307534382495591875444;
|
||||
uint256 constant IC1y = 11815610403687836973101173316230439195451705596735363851906854092591959915052;
|
||||
|
||||
uint256 constant IC2x = 16242579348146425525190457006101107419847405811499818317540754723473333632017;
|
||||
uint256 constant IC2y = 18683183869129065011286589913364125387934825500073790661871863906517984003320;
|
||||
uint256 constant IC2x = 3942468909901901476574835559131090434521376540167645627855127732340397237133;
|
||||
uint256 constant IC2y = 1261058758195212280843702811074975953961034592595369537313963317757147113688;
|
||||
|
||||
uint256 constant IC3x = 2204822258748363280048554662692301786018024193265048425094923113473651289387;
|
||||
uint256 constant IC3y = 9349496560174428345138295067730487322647625564526016632984103878442807226857;
|
||||
uint256 constant IC3x = 14058069178656014331002055906663504514386372319669759261437555160759445374547;
|
||||
uint256 constant IC3y = 10018204632443428210021740964447537723906897321704038358523152955670345045535;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_ecdsa_secp256r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 6430891513154449528164896213828600589247952180634403477178330402997812902246;
|
||||
uint256 constant deltax2 = 21601696758651084670923821177367656942143903410818955963322071262541394258510;
|
||||
uint256 constant deltay1 = 11092211554457431359587793366283217250709497808587838094753895936749367854375;
|
||||
uint256 constant deltay2 = 15730756398496732918430155419081506340763319554870404544587775680760500135544;
|
||||
uint256 constant deltax1 = 17446810484483871931372016647847455658230674862009886862984659796437899073641;
|
||||
uint256 constant deltax2 = 21706764551051025685216082562616246898490384465337142323291186653508790327282;
|
||||
uint256 constant deltay1 = 2270091033869821009616462801820956008669645319835757981707714884507871453242;
|
||||
uint256 constant deltay2 = 8468251531146844728095003444768950870862130674402885238669764472007003480603;
|
||||
|
||||
uint256 constant IC0x = 19830885681517570321356778157331498590843953078314254560503518446118203772152;
|
||||
uint256 constant IC0y = 16595190032474406166383744823960410984256509034693469068841343086726500247649;
|
||||
uint256 constant IC0x = 19921704592356202322519385449490775245345753924709802594178682788292077523850;
|
||||
uint256 constant IC0y = 500153351427820989269269935180872997090097869480768157366334963648314756044;
|
||||
|
||||
uint256 constant IC1x = 206924806773489186391212726584921916956610409477734208211742885188096591592;
|
||||
uint256 constant IC1y = 14374660937126324285115101145080473686748050880419214970461818849525315934198;
|
||||
uint256 constant IC1x = 15433426941796597560866672905690806069931422920027577317109747871771173589967;
|
||||
uint256 constant IC1y = 2570809804089172151434494437147672351277328467570191757621922811012669134667;
|
||||
|
||||
uint256 constant IC2x = 7297516874066837353335283393154280635608227716206858128773881457783462063640;
|
||||
uint256 constant IC2y = 4808834262795305139994582189568869698603398227598314116544415406134565415410;
|
||||
uint256 constant IC2x = 17004568555968529409726968653096199685247402293900109814387849940736990177656;
|
||||
uint256 constant IC2y = 13634587981919205862814197837050548541811391384265429714804418288958233253897;
|
||||
|
||||
uint256 constant IC3x = 19834510226948364257345434586235668518759040232058336504629203488016257053543;
|
||||
uint256 constant IC3y = 20150414611910167042901912653944906728052743015541319164045752952411517227280;
|
||||
uint256 constant IC3x = 13097759433387201741580981570212924654332086726192430780118201722414691137761;
|
||||
uint256 constant IC3y = 7845209344779415505874244383404703477754343670972551406959872660872359550923;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_ecdsa_secp384r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 19619918840484679320895916094276118000752377985872331995454187331223737670199;
|
||||
uint256 constant deltax2 = 9162215388587251537413213916651005774249408823999822136389416938542569897732;
|
||||
uint256 constant deltay1 = 575979407293981382991344290211462404272519230584209333212801915187118583211;
|
||||
uint256 constant deltay2 = 7736466517404914122567525685543061228966206792379385098246702109362142693103;
|
||||
uint256 constant deltax1 = 7156150326474315752689772647046410112253327230824436530363332480638849601533;
|
||||
uint256 constant deltax2 = 12349762674734315961806490075142999248317860688155648325988554733645711123888;
|
||||
uint256 constant deltay1 = 17778048337633377857692522902181290063703826344392633070034923203185336061872;
|
||||
uint256 constant deltay2 = 20169101568183340685972588488313042868105431148129470735473310504837853728506;
|
||||
|
||||
uint256 constant IC0x = 14376517488614065601219428040850402941773458989771353225268761878589012639348;
|
||||
uint256 constant IC0y = 5768634815067495729481658986290333930931362108699898583148029955092314720845;
|
||||
uint256 constant IC0x = 5351973060578055050651360096484086106169509759767041024621060141401396456468;
|
||||
uint256 constant IC0y = 19023244798312158343082553489527763647537261748615887594945611852270390943330;
|
||||
|
||||
uint256 constant IC1x = 16513226802075774073375414771053364987093921898138799627913632739002024706670;
|
||||
uint256 constant IC1y = 17442079741536153386809804237448908691035302979393670963773738427936297801452;
|
||||
uint256 constant IC1x = 4325501697698861663481351488454220785573099665143108391307534382495591875444;
|
||||
uint256 constant IC1y = 11815610403687836973101173316230439195451705596735363851906854092591959915052;
|
||||
|
||||
uint256 constant IC2x = 16242579348146425525190457006101107419847405811499818317540754723473333632017;
|
||||
uint256 constant IC2y = 18683183869129065011286589913364125387934825500073790661871863906517984003320;
|
||||
uint256 constant IC2x = 3942468909901901476574835559131090434521376540167645627855127732340397237133;
|
||||
uint256 constant IC2y = 1261058758195212280843702811074975953961034592595369537313963317757147113688;
|
||||
|
||||
uint256 constant IC3x = 2204822258748363280048554662692301786018024193265048425094923113473651289387;
|
||||
uint256 constant IC3y = 9349496560174428345138295067730487322647625564526016632984103878442807226857;
|
||||
uint256 constant IC3x = 14058069178656014331002055906663504514386372319669759261437555160759445374547;
|
||||
uint256 constant IC3y = 10018204632443428210021740964447537723906897321704038358523152955670345045535;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsa_3_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 1763194705908034776249727368467340832423871456698057938761915766843602844806;
|
||||
uint256 constant deltax2 = 15163743144229650771081062691380157543591710309316135883853862468139683722124;
|
||||
uint256 constant deltay1 = 1916839523943609270354164672970448190318547256666580246210579277125934649520;
|
||||
uint256 constant deltay2 = 20748667352198637258436456732374120151013900778095974739003057110379991797725;
|
||||
uint256 constant deltax1 = 6258187792819416603785136319567675730093428387025586871333801370942187363016;
|
||||
uint256 constant deltax2 = 3676037816653576039980102241466204114158683177815777433791112287937488616425;
|
||||
uint256 constant deltay1 = 1911510487969192927596729820322541143819582080602748360266116943782690710086;
|
||||
uint256 constant deltay2 = 13723461385906068815417857336897348110968138463593701005971772680782064483745;
|
||||
|
||||
uint256 constant IC0x = 11668722691456794904780276939864533315231090719344319792029084870686947321288;
|
||||
uint256 constant IC0y = 14598744982895527009555085349407700357548507224900618413945851269812024776679;
|
||||
uint256 constant IC0x = 3209765066172925742443116107612668910700026482516307698436072625995536468667;
|
||||
uint256 constant IC0y = 4517055933745945112563162008224089922128669726373080263505530229334408296722;
|
||||
|
||||
uint256 constant IC1x = 9535095301128327006974649953079890352408061075834795783020358990359373722276;
|
||||
uint256 constant IC1y = 3931944625634865089135412639668675234724160066034756680615290652788177552932;
|
||||
uint256 constant IC1x = 15095683808125901782476506573255088844219854842820124309350385219114547442771;
|
||||
uint256 constant IC1y = 2030619436244272542193475613572430362785568079758702066142372299938247426775;
|
||||
|
||||
uint256 constant IC2x = 10329806599658390793568960636386157543714375393447519121234354314604400436317;
|
||||
uint256 constant IC2y = 20112344586572627870408033078489054357146041060554591978507635305108711987320;
|
||||
uint256 constant IC2x = 19593496244330710728762694458146976726976923218466642502449947702967853165575;
|
||||
uint256 constant IC2y = 6553411276562397044055935529814729237616132420676219053290671023927618847865;
|
||||
|
||||
uint256 constant IC3x = 20653445411821942608596097010998649248241653280532587340156290377337770540687;
|
||||
uint256 constant IC3y = 10157833941113636929908495708697146708664488777896421394846979691818136880608;
|
||||
uint256 constant IC3x = 8743374151748053028370242747453520817614890529735466924308028514340997475827;
|
||||
uint256 constant IC3y = 8036772571561187149323591064733333847970037264910893219142351300501519032262;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 16820324219548447749399067352038862082324008140231073436942061064719857124550;
|
||||
uint256 constant deltax2 = 20216407575269205363321222186268712999845157279594044671256406241166057808408;
|
||||
uint256 constant deltay1 = 4176775956292332407066731154486255551898648628715105406107880498098840884559;
|
||||
uint256 constant deltay2 = 9781839749298399646263974040415415271068801233832836131612333390396163245418;
|
||||
uint256 constant deltax1 = 18381574722763426805416878481167511455460096904521685718665387161353789493248;
|
||||
uint256 constant deltax2 = 4121756490922931589599763379904928978455046936552174051616879517632408508340;
|
||||
uint256 constant deltay1 = 6379346836331165263681323157036661853641169739190447138023299755239674065492;
|
||||
uint256 constant deltay2 = 19579082302210213284357803705413476852137973878958870971682316940381759073297;
|
||||
|
||||
uint256 constant IC0x = 9120617312035651203824341472455044225706213747513935461679904471788890554440;
|
||||
uint256 constant IC0y = 15763572136288365984808838532832526702720509469968863568440424096921169073721;
|
||||
uint256 constant IC0x = 14565695636270690697623544454735082422877518868217825829327581184458532869806;
|
||||
uint256 constant IC0y = 7575819033963279939537467150586931919264667803664805491776179380112664021736;
|
||||
|
||||
uint256 constant IC1x = 1872769820414867165939596866141687290817385375212413419035748926572976755831;
|
||||
uint256 constant IC1y = 11147610265487368868507725827349677221415282435324418469204674867003077420244;
|
||||
uint256 constant IC1x = 2276727349714745591952640265272157516736355916536893184551546588210651841186;
|
||||
uint256 constant IC1y = 20577756868183061181773617083903691585147371337689939709415454802070047990344;
|
||||
|
||||
uint256 constant IC2x = 10199581256358757030736961304001409383429185978023548103429277999826571475691;
|
||||
uint256 constant IC2y = 6059222833427223581134983400008316379196988494673348424172030797122620065501;
|
||||
uint256 constant IC2x = 10979822596312322622577396222962819462106471110330119764581512649379017370205;
|
||||
uint256 constant IC2y = 15071935911466045185709679493204773212819682762936240619941552337771961030490;
|
||||
|
||||
uint256 constant IC3x = 3247507162605274368348757498443014920007805161681550229016512565918716714614;
|
||||
uint256 constant IC3y = 8573765989876689006689102472616159078300047648487377061122873749430599011522;
|
||||
uint256 constant IC3x = 11466169382019015588291144244836705629993167364506924804935058540376937061245;
|
||||
uint256 constant IC3y = 3653984801950564401434804431369441967569601766498662982176099991446265587327;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
@@ -61,10 +61,10 @@ contract Verifier_register_id_sha256_sha256_sha256_rsa_65537_4096 {
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint256[2] calldata _pA,
|
||||
uint256[2][2] calldata _pB,
|
||||
uint256[2] calldata _pC,
|
||||
uint256[3] calldata _pubSignals
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsapss_3_32_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 2781077716242132065250620899794396785588347795239696343446069906444234529390;
|
||||
uint256 constant deltax2 = 47077077777357687225029815126990571323103402811747918940776690684677647842;
|
||||
uint256 constant deltay1 = 1190353375318035625339189486679211246238870601578182679119161656625535685825;
|
||||
uint256 constant deltay2 = 8426480964265508408332360313535106526850830087521892053554354170573574669134;
|
||||
uint256 constant deltax1 = 456860955073314337388379287216226879504316866374967791100819855788776104654;
|
||||
uint256 constant deltax2 = 21760075519825462995873195595225612046286895804944048993877368962742658578129;
|
||||
uint256 constant deltay1 = 21087815495344284784745009345796534902252540591247551024748552610625411278774;
|
||||
uint256 constant deltay2 = 9809641933512012508146130419175068758014687576051130510883607160903009499566;
|
||||
|
||||
uint256 constant IC0x = 13257317710662954761750520144651828081320642337107868718776431658326596282131;
|
||||
uint256 constant IC0y = 11907840562353960908774022406953057774992557469266529054692981390691518606219;
|
||||
uint256 constant IC0x = 2933438513907776936073713491899753265213782069082163854723819776786084105353;
|
||||
uint256 constant IC0y = 9251594540498749595305513311827761830587497795287542572589675122727831704130;
|
||||
|
||||
uint256 constant IC1x = 15381755452619872738230613172999943069608702825134883363079687944958489890296;
|
||||
uint256 constant IC1y = 8202514855281296642785968167752083000145118685677619793648410468893468042259;
|
||||
uint256 constant IC1x = 6581769537810408801830265896077767839728739653758146604002432320418028980472;
|
||||
uint256 constant IC1y = 8657333254247243537939010824186836086303898396500506172998229277690277967288;
|
||||
|
||||
uint256 constant IC2x = 851235054719797220443750114256016514012924327807186022779007273071332017927;
|
||||
uint256 constant IC2y = 15394776390567673912480861544339679270868953148882022466712824384758130388107;
|
||||
uint256 constant IC2x = 1933997504804218304854472839607082988921088200569013654451474875321315535716;
|
||||
uint256 constant IC2y = 1084403501714066371235575264116680752535293820286884597143789849051560889355;
|
||||
|
||||
uint256 constant IC3x = 17409073715246386180305245371617950168231307785581946157865685446122594180051;
|
||||
uint256 constant IC3y = 16492607825021920907584694953598501207160310910409407062958062400852718949759;
|
||||
uint256 constant IC3x = 7938546847307989184007054708108005475735299911092061193802539054304409256004;
|
||||
uint256 constant IC3y = 7970172805252981257045596463888311488125821115303360668855347391577415707478;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsapss_65537_32_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 17501235404155957417320192215744912274275787397378158573671622756860814779567;
|
||||
uint256 constant deltax2 = 19329194966649185102731249084682512136256246610751736425952100035499254430565;
|
||||
uint256 constant deltay1 = 15975558220978684228456082787176994280921596172831423350461466668612139961930;
|
||||
uint256 constant deltay2 = 13285080282869144280224079778138951430539560992917503224992744036072160807137;
|
||||
uint256 constant deltax1 = 21373813527147290111509990916954698390734779025108685457826653646721574074526;
|
||||
uint256 constant deltax2 = 19605911076742476438390554244544345175899236736088652512786462794951670125544;
|
||||
uint256 constant deltay1 = 12599512507633002329190815561579405525009194900842162240550213360876036451368;
|
||||
uint256 constant deltay2 = 20060811906784750703894421114520744830115448675915833463822986405330820497195;
|
||||
|
||||
uint256 constant IC0x = 21748756285301773413817353666891370889612608328014449582293004586847305753634;
|
||||
uint256 constant IC0y = 18428467703991804860080730855333198272193437090732191054008321123534518961448;
|
||||
uint256 constant IC0x = 12373776365063986417599345257332404586930628223906621073810686776946686220558;
|
||||
uint256 constant IC0y = 8057774515737399563924789499579598677243994084365206755314186206726838785628;
|
||||
|
||||
uint256 constant IC1x = 8149573325397145916685988334829369581338699337627949121533245843666568835664;
|
||||
uint256 constant IC1y = 13513335528281906497079652857154673795772502338372317136665272870205044810490;
|
||||
uint256 constant IC1x = 4338342857157254565013208521933216835444694935527362432301321678819383645107;
|
||||
uint256 constant IC1y = 14788527344410492075205456228837002228278514929779643390189166044475230571860;
|
||||
|
||||
uint256 constant IC2x = 14918827804551141484556759898620767316756081360406118012162357600982685995683;
|
||||
uint256 constant IC2y = 19574391468598593714119008759682915036326156648094734328566217252580919300737;
|
||||
uint256 constant IC2x = 16989164629380019658494217237834904264497861635490383608748165652447678052541;
|
||||
uint256 constant IC2y = 14484960045094419926291544300631367632606962101025554514381835671207056805794;
|
||||
|
||||
uint256 constant IC3x = 19940990096280892875592368607489440538186994138405676794234921949002880719742;
|
||||
uint256 constant IC3y = 13751377284364416226265893006675437591889436937168441594151929701287280022999;
|
||||
uint256 constant IC3x = 1175864485826124824472850290710357098139650243659761875959487187796825503632;
|
||||
uint256 constant IC3y = 20908990483936359240194464896733617095195839332396083541228066026520009832542;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsapss_65537_32_3072 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 583976107033407292467750904278840941829638926288655671413655639639831158816;
|
||||
uint256 constant deltax2 = 21412263434087879367753729493454868074994602031279709979868079955557092950322;
|
||||
uint256 constant deltay1 = 8482009566555995381027670546356205538463031588720933767195962298342303232726;
|
||||
uint256 constant deltay2 = 9819205497238636981936994151900992168012099050059711660737336279021037733164;
|
||||
uint256 constant deltax1 = 9891621100777126026644774034906929999995740677331047570805242843727917239804;
|
||||
uint256 constant deltax2 = 3636642856342016925690145285864399817643718819498071628503089729482123246745;
|
||||
uint256 constant deltay1 = 1477383602005177350794202823251018739868162960822166452740354790087454230342;
|
||||
uint256 constant deltay2 = 6640750927040372552144327661945383181166790946858134146608907181729069579895;
|
||||
|
||||
uint256 constant IC0x = 21102310578316247452913896477332786708849995746925199916681180116237651440264;
|
||||
uint256 constant IC0y = 17147634907617296661948114814254270208908651483201381748601377808649755021259;
|
||||
uint256 constant IC0x = 3250322040513134624207653050702705770316609051269712242264746199610485979204;
|
||||
uint256 constant IC0y = 21615737994145283218574636550199007420215466106336093717104471814291749379093;
|
||||
|
||||
uint256 constant IC1x = 525255466197713666387532611968177309476290151384910219326295698371664380879;
|
||||
uint256 constant IC1y = 7843362245675457330014564912920603012210907001803901131931012786245099839869;
|
||||
uint256 constant IC1x = 4957844694321478107880715238481413484884147127026029932821309149795723001359;
|
||||
uint256 constant IC1y = 575038865539003443007495604278518635952661140455779807633871886838861383824;
|
||||
|
||||
uint256 constant IC2x = 1367810479281045529819281269395945866280653062465619451443924041505252894437;
|
||||
uint256 constant IC2y = 7482701051942021732854170261019127643029603214908612517434152752783192812733;
|
||||
uint256 constant IC2x = 2457424289019012082066968776948963050452182848486252530219879168565248490449;
|
||||
uint256 constant IC2y = 11568424660417954176675875424453340933847757424105818316367212806442408861828;
|
||||
|
||||
uint256 constant IC3x = 15605454276169516372371710406013368270465676374301786325995753144637926630969;
|
||||
uint256 constant IC3y = 1813462976563428257942455311988176468677002596577998910264017698739372018985;
|
||||
uint256 constant IC3x = 7224239665435526707286903995620998881483534532911839272110164941810931409009;
|
||||
uint256 constant IC3y = 15491252115256848573420834884963055403536909980627218715777561750639501784530;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -37,22 +37,22 @@ contract Verifier_register_id_sha256_sha256_sha256_rsapss_65537_64_2048 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 4165004033734156906974450733740936079965405950550042976161660248358701885772;
|
||||
uint256 constant deltax2 = 21526682903973063046327799421892992291819506471833195357590772467643209792464;
|
||||
uint256 constant deltay1 = 9526415747320166478332554017022198829396483785467622428190110068919582495087;
|
||||
uint256 constant deltay2 = 17014775723126509163571239865519001325798068285744623131217181132214523329660;
|
||||
uint256 constant deltax1 = 6329512870464850791407744004945185579578842507074531108713760078005824296350;
|
||||
uint256 constant deltax2 = 3619336362308396855785385934684941960260381336028730496937244444248454208022;
|
||||
uint256 constant deltay1 = 13847987577279107018848423829922675207806658317431757069649088290171811489599;
|
||||
uint256 constant deltay2 = 20253957843064405936440729736135622292502883714690513617387627559544832472293;
|
||||
|
||||
uint256 constant IC0x = 16751528413673747274541096479728467154936764443261163695198165462926683459972;
|
||||
uint256 constant IC0y = 14238739938580024236380473495662941585482225398743752849278205634378439024900;
|
||||
uint256 constant IC0x = 19972636934723875294500055191432097572315271118798459800961505579655077005714;
|
||||
uint256 constant IC0y = 20684105270943462386501753397747676051228951308952721244994206413216508312186;
|
||||
|
||||
uint256 constant IC1x = 8149573325397145916685988334829369581338699337627949121533245843666568835664;
|
||||
uint256 constant IC1y = 13513335528281906497079652857154673795772502338372317136665272870205044810490;
|
||||
uint256 constant IC1x = 4338342857157254565013208521933216835444694935527362432301321678819383645107;
|
||||
uint256 constant IC1y = 14788527344410492075205456228837002228278514929779643390189166044475230571860;
|
||||
|
||||
uint256 constant IC2x = 14918827804551141484556759898620767316756081360406118012162357600982685995683;
|
||||
uint256 constant IC2y = 19574391468598593714119008759682915036326156648094734328566217252580919300737;
|
||||
uint256 constant IC2x = 16989164629380019658494217237834904264497861635490383608748165652447678052541;
|
||||
uint256 constant IC2y = 14484960045094419926291544300631367632606962101025554514381835671207056805794;
|
||||
|
||||
uint256 constant IC3x = 19940990096280892875592368607489440538186994138405676794234921949002880719742;
|
||||
uint256 constant IC3y = 13751377284364416226265893006675437591889436937168441594151929701287280022999;
|
||||
uint256 constant IC3x = 1175864485826124824472850290710357098139650243659761875959487187796825503632;
|
||||
uint256 constant IC3y = 20908990483936359240194464896733617095195839332396083541228066026520009832542;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
// SPDX-License-Identifier: GPL-3.0
|
||||
/*
|
||||
Copyright 2021 0KIMS association.
|
||||
|
||||
This file is generated with [snarkJS](https://github.com/iden3/snarkjs).
|
||||
|
||||
snarkJS is a free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
snarkJS is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
pragma solidity >=0.7.0 <0.9.0;
|
||||
|
||||
contract Verifier_register_id_sha512_sha512_sha256_rsapss_65537_32_2048 {
|
||||
// Scalar field size
|
||||
uint256 constant r = 21888242871839275222246405745257275088548364400416034343698204186575808495617;
|
||||
// Base field size
|
||||
uint256 constant q = 21888242871839275222246405745257275088696311157297823662689037894645226208583;
|
||||
|
||||
// Verification Key data
|
||||
uint256 constant alphax = 20491192805390485299153009773594534940189261866228447918068658471970481763042;
|
||||
uint256 constant alphay = 9383485363053290200918347156157836566562967994039712273449902621266178545958;
|
||||
uint256 constant betax1 = 4252822878758300859123897981450591353533073413197771768651442665752259397132;
|
||||
uint256 constant betax2 = 6375614351688725206403948262868962793625744043794305715222011528459656738731;
|
||||
uint256 constant betay1 = 21847035105528745403288232691147584728191162732299865338377159692350059136679;
|
||||
uint256 constant betay2 = 10505242626370262277552901082094356697409835680220590971873171140371331206856;
|
||||
uint256 constant gammax1 = 11559732032986387107991004021392285783925812861821192530917403151452391805634;
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 21326107945733175258178926852351443586886663879769200205633713760155107656839;
|
||||
uint256 constant deltax2 = 4272033010013690553702354515780240801419965433642249353901928505914197825280;
|
||||
uint256 constant deltay1 = 19463355796294098325823676112274634203740873064289012541289808494585009753516;
|
||||
uint256 constant deltay2 = 10401513054659270720524001335238781473973823806962151821630463989395626333022;
|
||||
|
||||
uint256 constant IC0x = 4735377513577367390576214783215679810953341788803485205422395267834229098368;
|
||||
uint256 constant IC0y = 13007169143650910608519083930710584788852301061284628163378747906658914238181;
|
||||
|
||||
uint256 constant IC1x = 15293017169224264070266775810327688280530565900111179948100351658289754040798;
|
||||
uint256 constant IC1y = 180321444511434874198004382431880968861191122687951959831495129802852340485;
|
||||
|
||||
uint256 constant IC2x = 20239502180269221558306716755110966266985837938863579329172946580513551286712;
|
||||
uint256 constant IC2y = 4259353819157890719388802977397077298571793027403150053411117516128988141468;
|
||||
|
||||
uint256 constant IC3x = 8445892618635368813316214171327265172519378385140209500742423515607482424952;
|
||||
uint256 constant IC3y = 5185969622013661030361273199269512713020562452951505942207453467256415831266;
|
||||
|
||||
// Memory data
|
||||
uint16 constant pVk = 0;
|
||||
uint16 constant pPairing = 128;
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(
|
||||
uint[2] calldata _pA,
|
||||
uint[2][2] calldata _pB,
|
||||
uint[2] calldata _pC,
|
||||
uint[3] calldata _pubSignals
|
||||
) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
// G1 function to multiply a G1 value(x,y) to value in an address
|
||||
function g1_mulAccC(pR, x, y, s) {
|
||||
let success
|
||||
let mIn := mload(0x40)
|
||||
mstore(mIn, x)
|
||||
mstore(add(mIn, 32), y)
|
||||
mstore(add(mIn, 64), s)
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 7, mIn, 96, mIn, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
|
||||
mstore(add(mIn, 64), mload(pR))
|
||||
mstore(add(mIn, 96), mload(add(pR, 32)))
|
||||
|
||||
success := staticcall(sub(gas(), 2000), 6, mIn, 128, pR, 64)
|
||||
|
||||
if iszero(success) {
|
||||
mstore(0, 0)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
|
||||
function checkPairing(pA, pB, pC, pubSignals, pMem) -> isOk {
|
||||
let _pPairing := add(pMem, pPairing)
|
||||
let _pVk := add(pMem, pVk)
|
||||
|
||||
mstore(_pVk, IC0x)
|
||||
mstore(add(_pVk, 32), IC0y)
|
||||
|
||||
// Compute the linear combination vk_x
|
||||
|
||||
g1_mulAccC(_pVk, IC1x, IC1y, calldataload(add(pubSignals, 0)))
|
||||
|
||||
g1_mulAccC(_pVk, IC2x, IC2y, calldataload(add(pubSignals, 32)))
|
||||
|
||||
g1_mulAccC(_pVk, IC3x, IC3y, calldataload(add(pubSignals, 64)))
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
mstore(add(_pPairing, 32), mod(sub(q, calldataload(add(pA, 32))), q))
|
||||
|
||||
// B
|
||||
mstore(add(_pPairing, 64), calldataload(pB))
|
||||
mstore(add(_pPairing, 96), calldataload(add(pB, 32)))
|
||||
mstore(add(_pPairing, 128), calldataload(add(pB, 64)))
|
||||
mstore(add(_pPairing, 160), calldataload(add(pB, 96)))
|
||||
|
||||
// alpha1
|
||||
mstore(add(_pPairing, 192), alphax)
|
||||
mstore(add(_pPairing, 224), alphay)
|
||||
|
||||
// beta2
|
||||
mstore(add(_pPairing, 256), betax1)
|
||||
mstore(add(_pPairing, 288), betax2)
|
||||
mstore(add(_pPairing, 320), betay1)
|
||||
mstore(add(_pPairing, 352), betay2)
|
||||
|
||||
// vk_x
|
||||
mstore(add(_pPairing, 384), mload(add(pMem, pVk)))
|
||||
mstore(add(_pPairing, 416), mload(add(pMem, add(pVk, 32))))
|
||||
|
||||
// gamma2
|
||||
mstore(add(_pPairing, 448), gammax1)
|
||||
mstore(add(_pPairing, 480), gammax2)
|
||||
mstore(add(_pPairing, 512), gammay1)
|
||||
mstore(add(_pPairing, 544), gammay2)
|
||||
|
||||
// C
|
||||
mstore(add(_pPairing, 576), calldataload(pC))
|
||||
mstore(add(_pPairing, 608), calldataload(add(pC, 32)))
|
||||
|
||||
// delta2
|
||||
mstore(add(_pPairing, 640), deltax1)
|
||||
mstore(add(_pPairing, 672), deltax2)
|
||||
mstore(add(_pPairing, 704), deltay1)
|
||||
mstore(add(_pPairing, 736), deltay2)
|
||||
|
||||
let success := staticcall(sub(gas(), 2000), 8, _pPairing, 768, _pPairing, 0x20)
|
||||
|
||||
isOk := and(success, mload(_pPairing))
|
||||
}
|
||||
|
||||
let pMem := mload(0x40)
|
||||
mstore(0x40, add(pMem, pLastMem))
|
||||
|
||||
// Validate that all evaluations ∈ F
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 0)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 32)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 64)))
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
mstore(0, isValid)
|
||||
return(0, 0x20)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user