longfellow 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +152 -0
- data/ext/longfellow/CMakeLists.txt +76 -0
- data/ext/longfellow/extconf.rb +77 -0
- data/lib/longfellow/attribute.rb +65 -0
- data/lib/longfellow/c.rb +105 -0
- data/lib/longfellow/errors.rb +78 -0
- data/lib/longfellow/version.rb +5 -0
- data/lib/longfellow/zk_spec.rb +40 -0
- data/lib/longfellow.rb +162 -0
- data/sig/longfellow.rbs +74 -0
- data/vendor/longfellow-zk/LICENSE +203 -0
- data/vendor/longfellow-zk/lib/algebra/blas.h +121 -0
- data/vendor/longfellow-zk/lib/algebra/bogorng.h +68 -0
- data/vendor/longfellow-zk/lib/algebra/compare.h +40 -0
- data/vendor/longfellow-zk/lib/algebra/convolution.h +219 -0
- data/vendor/longfellow-zk/lib/algebra/crt.cc +42 -0
- data/vendor/longfellow-zk/lib/algebra/crt.h +299 -0
- data/vendor/longfellow-zk/lib/algebra/crt_convolution.h +114 -0
- data/vendor/longfellow-zk/lib/algebra/crt_test.cc +371 -0
- data/vendor/longfellow-zk/lib/algebra/fft.h +104 -0
- data/vendor/longfellow-zk/lib/algebra/fft_interpolation.h +304 -0
- data/vendor/longfellow-zk/lib/algebra/fft_interpolation_test.cc +168 -0
- data/vendor/longfellow-zk/lib/algebra/fft_test.cc +257 -0
- data/vendor/longfellow-zk/lib/algebra/fp.h +59 -0
- data/vendor/longfellow-zk/lib/algebra/fp2.h +240 -0
- data/vendor/longfellow-zk/lib/algebra/fp24.h +342 -0
- data/vendor/longfellow-zk/lib/algebra/fp24_6.h +305 -0
- data/vendor/longfellow-zk/lib/algebra/fp24_6_test.cc +197 -0
- data/vendor/longfellow-zk/lib/algebra/fp2_test.cc +280 -0
- data/vendor/longfellow-zk/lib/algebra/fp_generic.h +533 -0
- data/vendor/longfellow-zk/lib/algebra/fp_p128.h +91 -0
- data/vendor/longfellow-zk/lib/algebra/fp_p256.h +68 -0
- data/vendor/longfellow-zk/lib/algebra/fp_p256k1.h +123 -0
- data/vendor/longfellow-zk/lib/algebra/fp_p384.h +65 -0
- data/vendor/longfellow-zk/lib/algebra/fp_p521.h +62 -0
- data/vendor/longfellow-zk/lib/algebra/fp_test.cc +522 -0
- data/vendor/longfellow-zk/lib/algebra/hash.h +39 -0
- data/vendor/longfellow-zk/lib/algebra/interpolation.h +117 -0
- data/vendor/longfellow-zk/lib/algebra/interpolation_test.cc +74 -0
- data/vendor/longfellow-zk/lib/algebra/limb.h +153 -0
- data/vendor/longfellow-zk/lib/algebra/limb_test.cc +75 -0
- data/vendor/longfellow-zk/lib/algebra/nat.cc +32 -0
- data/vendor/longfellow-zk/lib/algebra/nat.h +212 -0
- data/vendor/longfellow-zk/lib/algebra/nat_test.cc +183 -0
- data/vendor/longfellow-zk/lib/algebra/nussbaumer.h +400 -0
- data/vendor/longfellow-zk/lib/algebra/nussbaumer_test.cc +138 -0
- data/vendor/longfellow-zk/lib/algebra/nussbaumerfp2_test.cc +139 -0
- data/vendor/longfellow-zk/lib/algebra/permutations.h +79 -0
- data/vendor/longfellow-zk/lib/algebra/poly.h +240 -0
- data/vendor/longfellow-zk/lib/algebra/poly_test.cc +123 -0
- data/vendor/longfellow-zk/lib/algebra/reed_solomon.h +150 -0
- data/vendor/longfellow-zk/lib/algebra/reed_solomon_extension.h +108 -0
- data/vendor/longfellow-zk/lib/algebra/reed_solomon_extension_test.cc +76 -0
- data/vendor/longfellow-zk/lib/algebra/reed_solomon_test.cc +473 -0
- data/vendor/longfellow-zk/lib/algebra/rfft.h +400 -0
- data/vendor/longfellow-zk/lib/algebra/rfft_test.cc +102 -0
- data/vendor/longfellow-zk/lib/algebra/static_string.h +29 -0
- data/vendor/longfellow-zk/lib/algebra/sysdep.h +495 -0
- data/vendor/longfellow-zk/lib/algebra/sysdep_test.cc +41 -0
- data/vendor/longfellow-zk/lib/algebra/twiddle.h +59 -0
- data/vendor/longfellow-zk/lib/algebra/utility.h +86 -0
- data/vendor/longfellow-zk/lib/algebra/utility_test.cc +86 -0
- data/vendor/longfellow-zk/lib/arrays/affine.h +56 -0
- data/vendor/longfellow-zk/lib/arrays/affine_test.cc +220 -0
- data/vendor/longfellow-zk/lib/arrays/dense.h +210 -0
- data/vendor/longfellow-zk/lib/arrays/eq.h +75 -0
- data/vendor/longfellow-zk/lib/arrays/eqs.h +137 -0
- data/vendor/longfellow-zk/lib/arrays/eqs_test.cc +151 -0
- data/vendor/longfellow-zk/lib/arrays/sparse.h +192 -0
- data/vendor/longfellow-zk/lib/cbor/host_decoder.h +323 -0
- data/vendor/longfellow-zk/lib/cbor/host_decoder_test.cc +541 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor.h +594 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_byte_decoder.h +150 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_byte_decoder_test.cc +147 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_constants.h +27 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_pluck.h +110 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_pluck_test.cc +55 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_test.cc +174 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_testing.h +98 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/cbor_witness.h +312 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/mso2_test.cc +662 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/mso_test.cc +485 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/scan.h +104 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser/scan_test.cc +137 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor.h +640 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor_byte_decoder.h +150 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor_byte_decoder_test.cc +147 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor_constants.h +27 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor_testing.h +99 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/cbor_witness.h +319 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/lexer_test.cc +120 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/mdoc_examples_test.cc +89 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/parser_circuit_test.cc +506 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/parser_size_test.cc +79 -0
- data/vendor/longfellow-zk/lib/circuits/cbor_parser_v2/parser_test.cc +473 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/canonicalization_test.cc +185 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/circuit_dump.h +65 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/compiler.h +471 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/compiler_test.cc +110 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/node.h +176 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/pdqhash.h +127 -0
- data/vendor/longfellow-zk/lib/circuits/compiler/schedule.h +435 -0
- data/vendor/longfellow-zk/lib/circuits/ecdsa/verify_circuit.h +371 -0
- data/vendor/longfellow-zk/lib/circuits/ecdsa/verify_external_test.cc +246 -0
- data/vendor/longfellow-zk/lib/circuits/ecdsa/verify_test.cc +587 -0
- data/vendor/longfellow-zk/lib/circuits/ecdsa/verify_witness.h +201 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_adder.h +140 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_adder_test.cc +64 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_plucker.h +247 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_plucker_constants.h +35 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_plucker_encoder.h +72 -0
- data/vendor/longfellow-zk/lib/circuits/logic/bit_plucker_test.cc +183 -0
- data/vendor/longfellow-zk/lib/circuits/logic/compiler_backend.h +62 -0
- data/vendor/longfellow-zk/lib/circuits/logic/counter.h +171 -0
- data/vendor/longfellow-zk/lib/circuits/logic/counter_test.cc +102 -0
- data/vendor/longfellow-zk/lib/circuits/logic/evaluation_backend.h +94 -0
- data/vendor/longfellow-zk/lib/circuits/logic/logic.h +1232 -0
- data/vendor/longfellow-zk/lib/circuits/logic/logic_circuit_test.cc +310 -0
- data/vendor/longfellow-zk/lib/circuits/logic/logic_test.cc +521 -0
- data/vendor/longfellow-zk/lib/circuits/logic/memcmp.h +68 -0
- data/vendor/longfellow-zk/lib/circuits/logic/memcmp_test.cc +148 -0
- data/vendor/longfellow-zk/lib/circuits/logic/polynomial.h +94 -0
- data/vendor/longfellow-zk/lib/circuits/logic/polynomial_test.cc +62 -0
- data/vendor/longfellow-zk/lib/circuits/logic/routing.h +445 -0
- data/vendor/longfellow-zk/lib/circuits/logic/routing_test.cc +241 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary.h +55 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary_plucker.h +77 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary_plucker_constants.h +37 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary_plucker_test.cc +53 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary_size_test.cc +69 -0
- data/vendor/longfellow-zk/lib/circuits/logic/unary_test.cc +62 -0
- data/vendor/longfellow-zk/lib/circuits/mac/mac_circuit.h +193 -0
- data/vendor/longfellow-zk/lib/circuits/mac/mac_circuit_test.cc +223 -0
- data/vendor/longfellow-zk/lib/circuits/mac/mac_reference.h +72 -0
- data/vendor/longfellow-zk/lib/circuits/mac/mac_witness.h +94 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/circuit_maker.cc +242 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_attribute_ids.h +311 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_attribute_test.cc +64 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_circuit_id.cc +85 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_constants.h +85 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_decompress.cc +41 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_decompress.h +27 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_examples.h +5232 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_generate_circuit.cc +199 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_hash.h +554 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_signature.h +143 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_signature_test.cc +444 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_test_attributes.h +157 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_witness.h +863 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_zk.cc +693 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_zk.h +216 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/mdoc_zk_test.cc +724 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/zk_spec.cc +100 -0
- data/vendor/longfellow-zk/lib/circuits/mdoc/zk_spec_test.cc +155 -0
- data/vendor/longfellow-zk/lib/circuits/sha/flatsha256_circuit.h +330 -0
- data/vendor/longfellow-zk/lib/circuits/sha/flatsha256_circuit_test.cc +607 -0
- data/vendor/longfellow-zk/lib/circuits/sha/flatsha256_io.h +26 -0
- data/vendor/longfellow-zk/lib/circuits/sha/flatsha256_witness.cc +163 -0
- data/vendor/longfellow-zk/lib/circuits/sha/flatsha256_witness.h +47 -0
- data/vendor/longfellow-zk/lib/circuits/sha/sha256_constants.cc +34 -0
- data/vendor/longfellow-zk/lib/circuits/sha/sha256_constants.h +27 -0
- data/vendor/longfellow-zk/lib/circuits/sha/sha256_test_values.h +389 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/ptrcred.h +171 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/small.h +218 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/small_examples.h +118 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/small_io.h +25 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/small_test.cc +208 -0
- data/vendor/longfellow-zk/lib/circuits/tests/anoncred/small_witness.h +130 -0
- data/vendor/longfellow-zk/lib/circuits/tests/base64/decode.h +508 -0
- data/vendor/longfellow-zk/lib/circuits/tests/base64/decode_circuit_test.cc +95 -0
- data/vendor/longfellow-zk/lib/circuits/tests/base64/decode_test.cc +119 -0
- data/vendor/longfellow-zk/lib/circuits/tests/base64/decode_util.cc +47 -0
- data/vendor/longfellow-zk/lib/circuits/tests/base64/decode_util.h +29 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ec/pk_circuit.h +231 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ec/pk_circuit_test.cc +428 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ec/pk_witness.h +102 -0
- data/vendor/longfellow-zk/lib/circuits/tests/jwt/jwt.h +190 -0
- data/vendor/longfellow-zk/lib/circuits/tests/jwt/jwt_constants.h +26 -0
- data/vendor/longfellow-zk/lib/circuits/tests/jwt/jwt_test.cc +559 -0
- data/vendor/longfellow-zk/lib/circuits/tests/jwt/jwt_witness.h +315 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_1f.h +411 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_1f_io.h +32 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_1f_test.cc +364 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_1f_witness.h +278 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_revocation.h +146 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_revocation_constants.h +25 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_revocation_test.cc +315 -0
- data/vendor/longfellow-zk/lib/circuits/tests/mdoc/mdoc_revocation_witness.h +136 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/bitaddr/bitaddr.h +250 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/bitaddr/bitaddr_test.cc +333 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/bitaddr/bitaddr_witness.h +152 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44.h +903 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_circuit_test.cc +274 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_eval_test.cc +440 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_examples.cc +8851 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_examples.h +93 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_types.cc +24 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_types.h +118 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_witness.h +453 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_44_witness_test.cc +49 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref.cc +458 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref.h +150 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref_test.cc +398 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref_test_vectors.inc +3618 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref_test_vectors_pkdecode.inc +689 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/ml_dsa_ref_test_vectors_sigdecode.inc +1501 -0
- data/vendor/longfellow-zk/lib/circuits/tests/pq/ml_dsa/sigdecode_test_vectors.inc +540 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ripemd/ripemd_circuit.h +394 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ripemd/ripemd_circuit_test.cc +577 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ripemd/ripemd_constants.h +90 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ripemd/ripemd_witness.cc +174 -0
- data/vendor/longfellow-zk/lib/circuits/tests/ripemd/ripemd_witness.h +140 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_circuit.h +351 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_circuit_test.cc +466 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_reference.cc +207 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_reference.h +59 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_reference_test.cc +153 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_round_constants.cc +39 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_round_constants.h +29 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_slicing.h +31 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_witness.cc +83 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/sha3_witness.h +72 -0
- data/vendor/longfellow-zk/lib/circuits/tests/sha3/shake_test_vectors.h +477 -0
- data/vendor/longfellow-zk/lib/ec/elliptic_curve.h +596 -0
- data/vendor/longfellow-zk/lib/ec/elliptic_curve_test.cc +548 -0
- data/vendor/longfellow-zk/lib/ec/p256.cc +36 -0
- data/vendor/longfellow-zk/lib/ec/p256.h +60 -0
- data/vendor/longfellow-zk/lib/ec/p256k1.cc +34 -0
- data/vendor/longfellow-zk/lib/ec/p256k1.h +60 -0
- data/vendor/longfellow-zk/lib/gf2k/gf2_128.h +503 -0
- data/vendor/longfellow-zk/lib/gf2k/gf2_128_bench.cc +48 -0
- data/vendor/longfellow-zk/lib/gf2k/gf2_128_test.cc +416 -0
- data/vendor/longfellow-zk/lib/gf2k/gf2poly.h +74 -0
- data/vendor/longfellow-zk/lib/gf2k/lch14.h +242 -0
- data/vendor/longfellow-zk/lib/gf2k/lch14_bench.cc +75 -0
- data/vendor/longfellow-zk/lib/gf2k/lch14_reed_solomon.h +127 -0
- data/vendor/longfellow-zk/lib/gf2k/lch14_reed_solomon_test.cc +110 -0
- data/vendor/longfellow-zk/lib/gf2k/lch14_test.cc +246 -0
- data/vendor/longfellow-zk/lib/gf2k/sysdep.h +329 -0
- data/vendor/longfellow-zk/lib/ligero/ligero_param.h +449 -0
- data/vendor/longfellow-zk/lib/ligero/ligero_prover.h +354 -0
- data/vendor/longfellow-zk/lib/ligero/ligero_test.cc +136 -0
- data/vendor/longfellow-zk/lib/ligero/ligero_transcript.h +67 -0
- data/vendor/longfellow-zk/lib/ligero/ligero_verifier.h +272 -0
- data/vendor/longfellow-zk/lib/merkle/merkle_commitment.h +104 -0
- data/vendor/longfellow-zk/lib/merkle/merkle_tree.h +216 -0
- data/vendor/longfellow-zk/lib/merkle/merkle_tree_test.cc +240 -0
- data/vendor/longfellow-zk/lib/proto/circuit.h +354 -0
- data/vendor/longfellow-zk/lib/proto/circuit_test.cc +202 -0
- data/vendor/longfellow-zk/lib/random/random.h +119 -0
- data/vendor/longfellow-zk/lib/random/random_test.cc +189 -0
- data/vendor/longfellow-zk/lib/random/secure_random_engine.h +37 -0
- data/vendor/longfellow-zk/lib/random/transcript.h +193 -0
- data/vendor/longfellow-zk/lib/random/transcript_test.cc +344 -0
- data/vendor/longfellow-zk/lib/sumcheck/circuit.h +148 -0
- data/vendor/longfellow-zk/lib/sumcheck/circuit_id.h +71 -0
- data/vendor/longfellow-zk/lib/sumcheck/equad.h +126 -0
- data/vendor/longfellow-zk/lib/sumcheck/hquad.h +115 -0
- data/vendor/longfellow-zk/lib/sumcheck/prover.h +59 -0
- data/vendor/longfellow-zk/lib/sumcheck/prover_layers.h +362 -0
- data/vendor/longfellow-zk/lib/sumcheck/quad.h +227 -0
- data/vendor/longfellow-zk/lib/sumcheck/quad_builder.h +211 -0
- data/vendor/longfellow-zk/lib/sumcheck/quad_test.cc +169 -0
- data/vendor/longfellow-zk/lib/sumcheck/sumcheck_test.cc +324 -0
- data/vendor/longfellow-zk/lib/sumcheck/testing.h +69 -0
- data/vendor/longfellow-zk/lib/sumcheck/transcript_sumcheck.h +85 -0
- data/vendor/longfellow-zk/lib/sumcheck/verifier.h +84 -0
- data/vendor/longfellow-zk/lib/sumcheck/verifier_layers.h +221 -0
- data/vendor/longfellow-zk/lib/testing/test_main.cc +50 -0
- data/vendor/longfellow-zk/lib/util/ceildiv.h +164 -0
- data/vendor/longfellow-zk/lib/util/ceildiv_test.cc +152 -0
- data/vendor/longfellow-zk/lib/util/crc64.h +45 -0
- data/vendor/longfellow-zk/lib/util/crypto.cc +39 -0
- data/vendor/longfellow-zk/lib/util/crypto.h +108 -0
- data/vendor/longfellow-zk/lib/util/log.cc +110 -0
- data/vendor/longfellow-zk/lib/util/log.h +33 -0
- data/vendor/longfellow-zk/lib/util/panic.h +40 -0
- data/vendor/longfellow-zk/lib/util/readbuffer.h +67 -0
- data/vendor/longfellow-zk/lib/util/serialization.h +54 -0
- data/vendor/longfellow-zk/lib/zk/zk_common.h +455 -0
- data/vendor/longfellow-zk/lib/zk/zk_proof.h +378 -0
- data/vendor/longfellow-zk/lib/zk/zk_prover.h +202 -0
- data/vendor/longfellow-zk/lib/zk/zk_test.cc +340 -0
- data/vendor/longfellow-zk/lib/zk/zk_testing.h +154 -0
- data/vendor/longfellow-zk/lib/zk/zk_verifier.h +109 -0
- metadata +347 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
#include "circuits/tests/base64/decode.h"
|
|
16
|
+
|
|
17
|
+
#include <cstddef>
|
|
18
|
+
#include <cstring>
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <vector>
|
|
21
|
+
|
|
22
|
+
#include "circuits/logic/evaluation_backend.h"
|
|
23
|
+
#include "circuits/logic/logic.h"
|
|
24
|
+
#include "ec/p256.h"
|
|
25
|
+
#include "util/log.h"
|
|
26
|
+
#include "gtest/gtest.h"
|
|
27
|
+
|
|
28
|
+
namespace proofs {
|
|
29
|
+
namespace {
|
|
30
|
+
|
|
31
|
+
template <class Field>
|
|
32
|
+
void test_each_symbol(const Field& F) {
|
|
33
|
+
using EvaluationBackend = EvaluationBackend<Field>;
|
|
34
|
+
using v8 = typename Logic<Field, EvaluationBackend>::v8;
|
|
35
|
+
using v6 = typename Logic<Field, EvaluationBackend>::template bitvec<6>;
|
|
36
|
+
const EvaluationBackend ebk(F, false);
|
|
37
|
+
const Logic<Field, EvaluationBackend> L(&ebk, F);
|
|
38
|
+
Base64Decoder<Logic<Field, EvaluationBackend> > bd(L);
|
|
39
|
+
|
|
40
|
+
v6 out, want;
|
|
41
|
+
v8 in;
|
|
42
|
+
|
|
43
|
+
std::string valid =
|
|
44
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
45
|
+
|
|
46
|
+
// Loop over all input symbols.
|
|
47
|
+
for (size_t c = 0; c < 256; ++c) {
|
|
48
|
+
in = L.template vbit<8>(c);
|
|
49
|
+
size_t ind = valid.find(c);
|
|
50
|
+
if (ind != std::string::npos) {
|
|
51
|
+
want = L.template vbit<6>(ind);
|
|
52
|
+
bd.decode(in, out);
|
|
53
|
+
EXPECT_EQ(L.eval(L.veq(out, want)), L.konst(1));
|
|
54
|
+
} else {
|
|
55
|
+
bd.decode(in, out);
|
|
56
|
+
bool failed = ebk.assertion_failed();
|
|
57
|
+
if (!failed) {
|
|
58
|
+
log(INFO, "expected failure on %x", c);
|
|
59
|
+
}
|
|
60
|
+
EXPECT_TRUE(failed);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
template <class Field>
|
|
66
|
+
void test_strings(const Field& F) {
|
|
67
|
+
using EvaluationBackend = EvaluationBackend<Field>;
|
|
68
|
+
using v8 = typename Logic<Field, EvaluationBackend>::v8;
|
|
69
|
+
const EvaluationBackend ebk(F, false);
|
|
70
|
+
const Logic<Field, EvaluationBackend> L(&ebk, F);
|
|
71
|
+
Base64Decoder<Logic<Field, EvaluationBackend> > bd(L);
|
|
72
|
+
|
|
73
|
+
struct test {
|
|
74
|
+
const char *want, *b64;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
struct test cases[] = {
|
|
78
|
+
{"hello", "aGVsbG8"},
|
|
79
|
+
{"s", "cw"},
|
|
80
|
+
{"ab", "YWI"},
|
|
81
|
+
{"333", "MzMz"},
|
|
82
|
+
{"4444", "NDQ0NA"},
|
|
83
|
+
{"55555", "NTU1NTU"},
|
|
84
|
+
{"{\"json\":\"woohoo\"}", "eyJqc29uIjoid29vaG9vIn0"},
|
|
85
|
+
{"{\"g\":{\"foo\":\"hh\"}}", "eyJnIjp7ImZvbyI6ImhoIn19"},
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
for (auto tc : cases) {
|
|
89
|
+
size_t n = strlen(tc.b64);
|
|
90
|
+
size_t on = n * 6 / 8;
|
|
91
|
+
EXPECT_EQ(strlen(tc.want), on);
|
|
92
|
+
std::vector<v8> inp(n), got(n);
|
|
93
|
+
for (size_t i = 0; i < n; ++i) {
|
|
94
|
+
inp[i] = L.template vbit<8>(tc.b64[i]);
|
|
95
|
+
}
|
|
96
|
+
bd.base64_rawurl_decode(inp.data(), got.data(), n);
|
|
97
|
+
for (size_t i = 0; i < on; ++i) {
|
|
98
|
+
EXPECT_EQ(L.eval(L.veq(got[i], L.template vbit<8>(tc.want[i]))),
|
|
99
|
+
L.konst(1));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
TEST(Base64, DecodeSymbol) {
|
|
105
|
+
using EvaluationBackend = EvaluationBackend<Fp256Base>;
|
|
106
|
+
const EvaluationBackend ebk(p256_base);
|
|
107
|
+
test_each_symbol(p256_base);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
TEST(Base64, DecodeBase64) {
|
|
111
|
+
using EvaluationBackend = EvaluationBackend<Fp256Base>;
|
|
112
|
+
const EvaluationBackend ebk(p256_base, false);
|
|
113
|
+
const Logic<Fp256Base, EvaluationBackend> L(&ebk, p256_base);
|
|
114
|
+
Base64Decoder<Logic<Fp256Base, EvaluationBackend> > bd(L);
|
|
115
|
+
test_strings(p256_base);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
} // namespace
|
|
119
|
+
} // namespace proofs
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
#include "circuits/tests/base64/decode_util.h"
|
|
16
|
+
|
|
17
|
+
#include <stdint.h>
|
|
18
|
+
|
|
19
|
+
#include <cstddef>
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
namespace proofs {
|
|
24
|
+
|
|
25
|
+
bool base64_decode_url(std::string inp, std::vector<uint8_t>& out) {
|
|
26
|
+
std::string valid =
|
|
27
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
28
|
+
|
|
29
|
+
for (size_t i = 0; i < inp.size(); i += 4) {
|
|
30
|
+
uint8_t quad[4] = {0}; /* a quad of 6 bits */
|
|
31
|
+
for (size_t j = 0; j < 4 && i + j < inp.size(); ++j) {
|
|
32
|
+
size_t ind = valid.find(inp[i + j]);
|
|
33
|
+
if (ind == std::string::npos) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
quad[j] = (uint8_t)ind;
|
|
37
|
+
}
|
|
38
|
+
uint8_t res[3] = {0};
|
|
39
|
+
res[0] = quad[0] << 2 | quad[1] >> 4;
|
|
40
|
+
res[1] = quad[1] << 4 | quad[2] >> 2;
|
|
41
|
+
res[2] = quad[2] << 6 | quad[3];
|
|
42
|
+
out.insert(out.end(), res, res + 3);
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
} // namespace proofs
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
#ifndef PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_BASE64_DECODE_UTIL_H_
|
|
16
|
+
#define PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_BASE64_DECODE_UTIL_H_
|
|
17
|
+
|
|
18
|
+
#include <stdint.h>
|
|
19
|
+
|
|
20
|
+
#include <string>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
namespace proofs {
|
|
24
|
+
|
|
25
|
+
bool base64_decode_url(std::string inp, std::vector<uint8_t>& out);
|
|
26
|
+
|
|
27
|
+
} // namespace proofs
|
|
28
|
+
|
|
29
|
+
#endif // PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_BASE64_DECODE_UTIL_H_
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
// Copyright 2026 Google LLC.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
|
|
15
|
+
#ifndef PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_EC_PK_CIRCUIT_H_
|
|
16
|
+
#define PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_EC_PK_CIRCUIT_H_
|
|
17
|
+
|
|
18
|
+
#include <stddef.h>
|
|
19
|
+
|
|
20
|
+
namespace proofs {
|
|
21
|
+
|
|
22
|
+
// Verifies that a public key (pkx, pky) is derived from a secret scalar sk
|
|
23
|
+
// such that (pkx, pky) = sk * G, where G is the generator of the curve.
|
|
24
|
+
template <class LogicCircuit, class Field, class EC>
|
|
25
|
+
class Ecpk {
|
|
26
|
+
using EltW = typename LogicCircuit::EltW;
|
|
27
|
+
using Elt = typename LogicCircuit::Elt;
|
|
28
|
+
static constexpr size_t kBits = EC::kBits;
|
|
29
|
+
|
|
30
|
+
public:
|
|
31
|
+
struct Witness {
|
|
32
|
+
EltW bits[kBits];
|
|
33
|
+
EltW int_x[kBits];
|
|
34
|
+
EltW int_y[kBits];
|
|
35
|
+
EltW int_z[kBits];
|
|
36
|
+
|
|
37
|
+
void input(const LogicCircuit& lc) {
|
|
38
|
+
for (size_t i = 0; i < kBits; ++i) {
|
|
39
|
+
bits[i] = lc.eltw_input();
|
|
40
|
+
if (i < kBits - 1) {
|
|
41
|
+
int_x[i] = lc.eltw_input();
|
|
42
|
+
int_y[i] = lc.eltw_input();
|
|
43
|
+
int_z[i] = lc.eltw_input();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
Ecpk(const LogicCircuit& lc, const EC& ec) : lc_(lc), ec_(ec) {}
|
|
50
|
+
|
|
51
|
+
// Verifies that (pkx, pky) = sk * G
|
|
52
|
+
// The witness contains the bits of sk and intermediate points.
|
|
53
|
+
void assert_public_key(EltW pk_x, EltW pk_y, const Witness& w) const {
|
|
54
|
+
EltW zero = lc_.konst(lc_.zero());
|
|
55
|
+
EltW one = lc_.konst(lc_.one());
|
|
56
|
+
EltW gx = lc_.konst(ec_.gx_);
|
|
57
|
+
EltW gy = lc_.konst(ec_.gy_);
|
|
58
|
+
|
|
59
|
+
// Initialize at the point at infinity (0, 1, 0)
|
|
60
|
+
EltW ax = zero, ay = one, az = zero;
|
|
61
|
+
|
|
62
|
+
// Traverse bits from high to low (standard double-and-add)
|
|
63
|
+
for (size_t i = 0; i < kBits; ++i) {
|
|
64
|
+
typename LogicCircuit::BitW b_bit(w.bits[i], lc_.f_);
|
|
65
|
+
lc_.assert_is_bit(b_bit);
|
|
66
|
+
|
|
67
|
+
// Select point to add based on bit: if 1 -> G, if 0 -> Infinity
|
|
68
|
+
// Infinity = (0, 1, 0)
|
|
69
|
+
EltW tx = lc_.mux(b_bit, gx, zero);
|
|
70
|
+
EltW ty = lc_.mux(b_bit, gy, one);
|
|
71
|
+
EltW tz = lc_.mux(b_bit, one, zero);
|
|
72
|
+
|
|
73
|
+
// Double the current accumulator
|
|
74
|
+
doubleE(ax, ay, az, ax, ay, az);
|
|
75
|
+
|
|
76
|
+
addE(ax, ay, az, ax, ay, az, tx, ty, tz);
|
|
77
|
+
|
|
78
|
+
// Check against intermediate witness
|
|
79
|
+
if (i < kBits - 1) {
|
|
80
|
+
// Ensure that the resulting point is equal to the intermediate
|
|
81
|
+
// point provided as input. Performing an explicit equality check
|
|
82
|
+
// ensures that all intermediate witness points are on the curve.
|
|
83
|
+
// This follows by induction. The first (ax,ay,az) is on the curve.
|
|
84
|
+
// The addition formula ensures that the i-th (ax,ay,az) is on the
|
|
85
|
+
// curve; equality ensures that the i-th witness is on the curve.
|
|
86
|
+
lc_.assert_eq(ax, w.int_x[i]);
|
|
87
|
+
lc_.assert_eq(ay, w.int_y[i]);
|
|
88
|
+
lc_.assert_eq(az, w.int_z[i]);
|
|
89
|
+
|
|
90
|
+
// Proceed with witnessed values
|
|
91
|
+
ax = w.int_x[i];
|
|
92
|
+
ay = w.int_y[i];
|
|
93
|
+
az = w.int_z[i];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Final check: Accumulator should match (pkx, pky).
|
|
98
|
+
// (ax,ay,az) is guaranteed to be on the curve by induction,
|
|
99
|
+
// and the (pkx,pky,1) is a public input that is checked below,
|
|
100
|
+
// and not the point at infinity.
|
|
101
|
+
assert_equal_projective(ax, ay, az, pk_x, pk_y, one);
|
|
102
|
+
|
|
103
|
+
// Also verify (pkx, pky) is on curve
|
|
104
|
+
is_on_curve(pk_x, pk_y);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
private:
|
|
108
|
+
// This check is only valid when *both* input points are on the
|
|
109
|
+
// curve or the point at infinity represented as (0,1,0).
|
|
110
|
+
void assert_equal_projective(EltW x1, EltW y1, EltW z1, EltW x2, EltW y2,
|
|
111
|
+
EltW z2) const {
|
|
112
|
+
// Check projective equality: X1*Z2 == X2*Z1, Y1*Z2 == Y2*Z1
|
|
113
|
+
EltW lhs_x = lc_.mul(x1, z2);
|
|
114
|
+
EltW rhs_x = lc_.mul(x2, z1);
|
|
115
|
+
lc_.assert_eq(lhs_x, rhs_x);
|
|
116
|
+
|
|
117
|
+
EltW lhs_y = lc_.mul(y1, z2);
|
|
118
|
+
EltW rhs_y = lc_.mul(y2, z1);
|
|
119
|
+
lc_.assert_eq(lhs_y, rhs_y);
|
|
120
|
+
}
|
|
121
|
+
void is_on_curve(EltW x, EltW y) const {
|
|
122
|
+
// Check that y^2 = x^3 + ax + b
|
|
123
|
+
auto yy = lc_.mul(y, y);
|
|
124
|
+
auto xx = lc_.mul(x, x);
|
|
125
|
+
auto xxx = lc_.mul(x, xx);
|
|
126
|
+
auto ax = lc_.mul(ec_.a_, x);
|
|
127
|
+
auto b = lc_.konst(ec_.b_);
|
|
128
|
+
auto axb = lc_.add(ax, b);
|
|
129
|
+
auto rhs = lc_.add(axb, xxx);
|
|
130
|
+
lc_.assert_eq(yy, rhs);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
void addE(EltW& X3, EltW& Y3, EltW& Z3, EltW X1, EltW Y1, EltW Z1, EltW X2,
|
|
134
|
+
EltW Y2, EltW Z2) const {
|
|
135
|
+
// Copied from VerifyCircuit
|
|
136
|
+
EltW t0 = lc_.mul(X1, X2);
|
|
137
|
+
EltW t1 = lc_.mul(Y1, Y2);
|
|
138
|
+
EltW t2 = lc_.mul(Z1, Z2);
|
|
139
|
+
EltW t3 = lc_.add(X1, Y1);
|
|
140
|
+
EltW t4 = lc_.add(X2, Y2);
|
|
141
|
+
t3 = lc_.mul(t3, t4);
|
|
142
|
+
t4 = lc_.add(t0, t1);
|
|
143
|
+
t3 = lc_.sub(t3, t4);
|
|
144
|
+
t4 = lc_.add(X1, Z1);
|
|
145
|
+
EltW t5 = lc_.add(X2, Z2);
|
|
146
|
+
t4 = lc_.mul(t4, t5);
|
|
147
|
+
t5 = lc_.add(t0, t2);
|
|
148
|
+
t4 = lc_.sub(t4, t5);
|
|
149
|
+
t5 = lc_.add(Y1, Z1);
|
|
150
|
+
EltW X3t = lc_.add(Y2, Z2);
|
|
151
|
+
t5 = lc_.mul(t5, X3t);
|
|
152
|
+
X3t = lc_.add(t1, t2);
|
|
153
|
+
t5 = lc_.sub(t5, X3t);
|
|
154
|
+
auto a = lc_.konst(ec_.a_);
|
|
155
|
+
EltW Z3t = lc_.mul(a, t4);
|
|
156
|
+
auto k3b = lc_.konst(ec_.k3b);
|
|
157
|
+
X3t = lc_.mul(k3b, t2);
|
|
158
|
+
Z3t = lc_.add(X3t, Z3t);
|
|
159
|
+
X3t = lc_.sub(t1, Z3t);
|
|
160
|
+
Z3t = lc_.add(t1, Z3t);
|
|
161
|
+
EltW Y3t = lc_.mul(X3t, Z3t);
|
|
162
|
+
t1 = lc_.add(t0, t0);
|
|
163
|
+
t1 = lc_.add(t1, t0);
|
|
164
|
+
t2 = lc_.mul(a, t2);
|
|
165
|
+
t4 = lc_.mul(k3b, t4);
|
|
166
|
+
t1 = lc_.add(t1, t2);
|
|
167
|
+
t2 = lc_.sub(t0, t2);
|
|
168
|
+
t2 = lc_.mul(a, t2);
|
|
169
|
+
t4 = lc_.add(t4, t2);
|
|
170
|
+
t0 = lc_.mul(t1, t4);
|
|
171
|
+
Y3t = lc_.add(Y3t, t0);
|
|
172
|
+
t0 = lc_.mul(t5, t4);
|
|
173
|
+
X3t = lc_.mul(t3, X3t);
|
|
174
|
+
X3t = lc_.sub(X3t, t0);
|
|
175
|
+
t0 = lc_.mul(t3, t1);
|
|
176
|
+
Z3t = lc_.mul(t5, Z3t);
|
|
177
|
+
Z3t = lc_.add(Z3t, t0);
|
|
178
|
+
|
|
179
|
+
X3 = X3t;
|
|
180
|
+
Y3 = Y3t;
|
|
181
|
+
Z3 = Z3t;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
void doubleE(EltW& X3, EltW& Y3, EltW& Z3, EltW X, EltW Y, EltW Z) const {
|
|
185
|
+
// Copied from VerifyCircuit
|
|
186
|
+
EltW t0 = lc_.mul(X, X);
|
|
187
|
+
EltW t1 = lc_.mul(Y, Y);
|
|
188
|
+
EltW t2 = lc_.mul(Z, Z);
|
|
189
|
+
EltW t3 = lc_.mul(X, Y);
|
|
190
|
+
t3 = lc_.add(t3, t3);
|
|
191
|
+
EltW Z3t = lc_.mul(X, Z);
|
|
192
|
+
Z3t = lc_.add(Z3t, Z3t);
|
|
193
|
+
auto a = lc_.konst(ec_.a_);
|
|
194
|
+
auto k3b = lc_.konst(ec_.k3b);
|
|
195
|
+
EltW X3t = lc_.mul(a, Z3t);
|
|
196
|
+
EltW Y3t = lc_.mul(k3b, t2);
|
|
197
|
+
Y3t = lc_.add(X3t, Y3t);
|
|
198
|
+
X3t = lc_.sub(t1, Y3t);
|
|
199
|
+
Y3t = lc_.add(t1, Y3t);
|
|
200
|
+
Y3t = lc_.mul(X3t, Y3t);
|
|
201
|
+
X3t = lc_.mul(t3, X3t);
|
|
202
|
+
Z3t = lc_.mul(k3b, Z3t);
|
|
203
|
+
t2 = lc_.mul(a, t2);
|
|
204
|
+
t3 = lc_.sub(t0, t2);
|
|
205
|
+
t3 = lc_.mul(a, t3);
|
|
206
|
+
t3 = lc_.add(t3, Z3t);
|
|
207
|
+
Z3t = lc_.add(t0, t0);
|
|
208
|
+
t0 = lc_.add(Z3t, t0);
|
|
209
|
+
t0 = lc_.add(t0, t2);
|
|
210
|
+
t0 = lc_.mul(t0, t3);
|
|
211
|
+
Y3t = lc_.add(Y3t, t0);
|
|
212
|
+
t2 = lc_.mul(Y, Z);
|
|
213
|
+
t2 = lc_.add(t2, t2);
|
|
214
|
+
t0 = lc_.mul(t2, t3);
|
|
215
|
+
X3t = lc_.sub(X3t, t0);
|
|
216
|
+
Z3t = lc_.mul(t2, t1);
|
|
217
|
+
Z3t = lc_.add(Z3t, Z3t);
|
|
218
|
+
Z3t = lc_.add(Z3t, Z3t);
|
|
219
|
+
|
|
220
|
+
X3 = X3t;
|
|
221
|
+
Y3 = Y3t;
|
|
222
|
+
Z3 = Z3t;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const LogicCircuit& lc_;
|
|
226
|
+
const EC& ec_;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
} // namespace proofs
|
|
230
|
+
|
|
231
|
+
#endif // PRIVACY_PROOFS_ZK_LIB_CIRCUITS_TESTS_EC_PK_CIRCUIT_H_
|