public void TestSimpleHashZ() { var expectedHashZ = "69727408650258925666157816894980607074870114162787023360036165814485426747693"; var phe = new PheCrypto(); var hashZ = phe.HashZ(Domains.ProofOK, phe.CurveG.GetEncoded()); Assert.Equal(new BigInteger(expectedHashZ, 10), hashZ); }
public void TestHashZVector2() { var pub = new byte[] { 0x04, 0x39, 0x01, 0x9b, 0x9e, 0x2f, 0x1b, 0xae, 0x60, 0x65, 0xcd, 0x9b, 0x85, 0x94, 0xfe, 0xa6, 0xe3, 0x5a, 0x9a, 0xfd, 0xd3, 0x15, 0x96, 0xca, 0xd8, 0xf8, 0xa4, 0xb1, 0xbd, 0xcd, 0x9b, 0x24, 0x40, 0x5b, 0x8b, 0x13, 0x23, 0xf2, 0xdd, 0x6b, 0x1b, 0x1d, 0x3f, 0x57, 0x5d, 0x00, 0xf4, 0xa8, 0x5f, 0xb8, 0x67, 0x90, 0x69, 0x74, 0xea, 0x16, 0x4b, 0x41, 0x9e, 0x93, 0x66, 0x47, 0xd8, 0xfb, 0x7b, }; var c0X = "66305582120524875023859689648303664817335268054431490163250455437389177295478"; var c0Y = "19615011428787373705295950431517815162915845805720956004550495681707511034851"; var c1X = "11237049376971579382843942757546874380042467137583453135179008882019225463739"; var c1Y = "80961525191994723690800208523971748057046695876178833586656397502847317233228"; var t1X = "39244241269455735193598520026736537476566784866134072628798326598844377151651"; var t1Y = "10612278657611837393693400625940452527356993857624739575347941960949401758261"; var t2X = "108016526337105983792792579967716341976396349948643843073602635679441433077833"; var t2Y = "90379537067318020066230942533439624193620174277378193732900885672181004096656"; var t3X = "36913295823787819500630010367019659122715720420780370192192548665300728488299"; var t3Y = "36547572032269541322937508337036635249923361457001752921238955135105574250650"; var t4X = "49166285642990312777312778351013119878896537776050488997315166935690363463787"; var t4Y = "66983832439067043864623691503721372978034854603698954939248898067109763920732"; var chlng = "98801234524135497507777343590157351416109876307242902372535142932873423904771"; var phe = new PheCrypto(); var c0 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(c0X, 10), new BigInteger(c0Y, 10)); var c1 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(c1X, 10), new BigInteger(c1Y, 10)); var t1 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t1X, 10), new BigInteger(t1Y, 10)); var t2 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t2X, 10), new BigInteger(t2Y, 10)); var t3 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t3X, 10), new BigInteger(t3Y, 10)); var t4 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t4X, 10), new BigInteger(t4Y, 10)); var hashZ = phe.HashZ( Domains.ProofErr, pub, phe.CurveG.GetEncoded(), c0.GetEncoded(), c1.GetEncoded(), t1.GetEncoded(), t2.GetEncoded(), t3.GetEncoded(), t4.GetEncoded()); Assert.Equal(new BigInteger(chlng, 10), hashZ); }
public void TestHashZVector1() { var pub = new byte[] { 0x04, 0x21, 0xc3, 0x71, 0x95, 0x74, 0xaf, 0xce, 0xc6, 0x5e, 0x35, 0xbd, 0x77, 0x5a, 0x5b, 0xe3, 0x6c, 0x77, 0xc0, 0xbe, 0x45, 0x01, 0xf5, 0xd7, 0x0f, 0xf0, 0x70, 0xd5, 0x1a, 0x89, 0x3a, 0xd8, 0xe0, 0x0c, 0xe6, 0xb8, 0x9b, 0x17, 0x88, 0xe6, 0xc1, 0x27, 0xa0, 0xe1, 0x25, 0xd9, 0xde, 0x6a, 0x71, 0x16, 0x46, 0xa0, 0x38, 0x0f, 0xc4, 0xe9, 0x5a, 0x74, 0xe5, 0x2c, 0x89, 0xf1, 0x12, 0x2a, 0x7c, }; var c0X = "97803661066250274657510595696566855164534492744724548093309723513248461995097"; var c0Y = "32563640650805051226489658838020042684659728733816530715089727234214066735908"; var c1X = "83901588226167680046300869772314554609808129217097458603677198943293551162597"; var c1Y = "69578797673242144759724361924884259223786981560985539034793627438888366836078"; var t1X = "34051691470374495568913340263568595354597873005782528499014802063444122859583"; var t1Y = "55902370943165854960816059167184401667567213725158022607170263924097403943290"; var t2X = "101861885104337123215820986653465602199317278936192518417111183141791463240617"; var t2Y = "40785451420258280256125533532563267231769863378114083364571107590767796025737"; var t3X = "79689595215343344259388135277552904427007069090288122793121340067386243614518"; var t3Y = "63043970895569149637126206639504503565389755448934804609068720159153015056302"; var chlng = "93919747365284119397236447539917482315419780885577135068398876525953972539838"; var phe = new PheCrypto(); var c0 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(c0X, 10), new BigInteger(c0Y, 10)); var c1 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(c1X, 10), new BigInteger(c1Y, 10)); var t1 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t1X, 10), new BigInteger(t1Y, 10)); var t2 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t2X, 10), new BigInteger(t2Y, 10)); var t3 = (FpPoint)phe.Curve.CreatePoint(new BigInteger(t3X, 10), new BigInteger(t3Y, 10)); var hashZ = phe.HashZ(Domains.ProofOK, pub, phe.CurveG.GetEncoded(), c0.GetEncoded(), c1.GetEncoded(), t1.GetEncoded(), t2.GetEncoded(), t3.GetEncoded()); Assert.Equal(new BigInteger(chlng, 10), hashZ); }