|
purify
C++ Purify implementation with native circuit and BPP support
|
C++ convenience wrappers over the low-level BPPP C bridge. More...
#include "purify/bppp.hpp"#include <algorithm>#include <cstdint>#include <cstring>#include <limits>#include <memory>#include <span>#include <string>#include <string_view>#include <tuple>#include <type_traits>#include <unordered_map>#include <vector>#include "bppp_bridge.h"#include "bulletproof_internal.hpp"#include "purify/secp_bridge.h"Go to the source code of this file.
Data Structures | |
| struct | purify::bppp::BpppBackendResourcesDeleter |
| struct | purify::bppp::GeneratorBackendCacheKeyHash |
| struct | purify::bppp::ExperimentalCircuitCacheLine::Impl |
| struct | purify::bppp::ExperimentalCircuitCache::Impl |
Namespaces | |
| namespace | purify |
| namespace | purify::bppp |
Typedefs | |
| using | purify::bppp::OwnedBpppBackendResources = std::unique_ptr< purify_bppp_backend_resources, BpppBackendResourcesDeleter > |
| using | purify::bppp::GeneratorBackendCacheKey = std::array< unsigned char, 32 > |
| using | purify::bppp::CircuitNormArgPublicDataCacheKey = std::array< unsigned char, 32 > |
| using | purify::bppp::CircuitNormArgPublicDataCacheKeyHash = GeneratorBackendCacheKeyHash |
Functions | |
| template<typename Digest > | |
| std::size_t | purify::bppp::digest_prefix_hash (const Digest &digest) noexcept |
| GeneratorBackendCacheKey | purify::bppp::generator_backend_cache_key (std::span< const PointBytes > generators) |
| GeneratorBytes | purify::bppp::base_generator (purify_secp_context *secp_context) |
| Returns the serialized secp256k1 base generator used as the blind generator. | |
| GeneratorBytes | purify::bppp::value_generator_h (purify_secp_context *secp_context) |
| Returns the serialized alternate generator used for committed values. | |
| Result< std::vector< PointBytes > > | purify::bppp::create_generators (std::size_t count, purify_secp_context *secp_context) |
| Expands the BPPP generator list. | |
| Result< PointBytes > | purify::bppp::commit_norm_arg_with_cache (const NormArgInputs &inputs, purify_secp_context *secp_context, ExperimentalCircuitBackend *cache=nullptr) |
| Result< PointBytes > | purify::bppp::pedersen_commit_char (const ScalarBytes &blind, const ScalarBytes &value, purify_secp_context *secp_context) |
| Computes a Pedersen commitment to an arbitrary 32-byte scalar value using Purify's default generators. | |
| Result< PointBytes > | purify::bppp::pedersen_commit_char (const ScalarBytes &blind, const ScalarBytes &value, purify_secp_context *secp_context, const GeneratorBytes &value_gen, const GeneratorBytes &blind_gen) |
| Computes a Pedersen commitment to an arbitrary 32-byte scalar value with explicit generators. | |
| Result< NormArgProof > | purify::bppp::prove_norm_arg (const NormArgInputs &inputs, purify_secp_context *secp_context) |
| Produces a standalone BPPP norm argument. | |
| Result< NormArgProof > | purify::bppp::prove_norm_arg (NormArgInputs &&inputs, purify_secp_context *secp_context) |
| Produces a standalone BPPP norm argument, moving large inputs into the returned proof when possible. | |
| Result< NormArgProof > | purify::bppp::prove_norm_arg_to_commitment_with_cache (const NormArgInputs &inputs, const PointBytes &commitment, purify_secp_context *secp_context, ExperimentalCircuitBackend *cache=nullptr) |
| bool | purify::bppp::verify_norm_arg_with_cache (const NormArgProof &proof, purify_secp_context *secp_context, ExperimentalCircuitBackend *cache=nullptr) |
| Result< PointBytes > | purify::bppp::commit_norm_arg (const NormArgInputs &inputs, purify_secp_context *secp_context) |
| Computes the public BPPP commitment for a standalone norm-argument input bundle. | |
| Result< NormArgProof > | purify::bppp::prove_norm_arg_to_commitment (const NormArgInputs &inputs, const PointBytes &commitment, purify_secp_context *secp_context) |
| Produces a standalone BPPP norm argument anchored to a caller-supplied public commitment. | |
| bool | purify::bppp::verify_norm_arg (const NormArgProof &proof, purify_secp_context *secp_context) |
| Verifies a standalone BPPP norm argument. | |
| Result< PointBytes > | purify::bppp::commit_experimental_circuit_witness (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Commits to the reduced witness coordinates used by the experimental circuit-to-BPPP reduction. | |
| Result< ExperimentalCircuitNormArgProof > | purify::bppp::prove_experimental_circuit_norm_arg_to_commitment (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const PointBytes &witness_commitment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Produces an anchored transparent circuit proof against a caller-supplied reduced witness commitment. | |
| Result< ExperimentalCircuitNormArgProof > | purify::bppp::prove_experimental_circuit_norm_arg (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Produces an anchored transparent circuit proof using the experimental circuit-to-BPPP reduction. | |
| Result< bool > | purify::bppp::verify_experimental_circuit_norm_arg (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitNormArgProof &proof, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
Verifies an experimental transparent circuit proof produced by prove_experimental_circuit_norm_arg. | |
| Result< ExperimentalCircuitZkNormArgProof > | purify::bppp::prove_experimental_circuit_zk_norm_arg_impl (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &nonce, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding, bool externalize_commitments, ExperimentalCircuitBackend *cache) |
| Result< bool > | purify::bppp::verify_experimental_circuit_zk_norm_arg_impl (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitZkNormArgProof &proof, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding, bool externalize_commitments, ExperimentalCircuitBackend *cache) |
| Result< ExperimentalCircuitZkNormArgProof > | purify::bppp::prove_experimental_circuit_zk_norm_arg (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &nonce, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Produces an experimental masked circuit proof over the reduced BPPP relation. | |
| Result< bool > | purify::bppp::verify_experimental_circuit_zk_norm_arg (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitZkNormArgProof &proof, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
Verifies an experimental masked circuit proof produced by prove_experimental_circuit_zk_norm_arg. | |
| Result< ExperimentalCircuitZkNormArgProof > | purify::bppp::prove_experimental_circuit_zk_norm_arg_with_public_commitments (const NativeBulletproofCircuit &circuit, const BulletproofAssignmentData &assignment, const ScalarBytes &nonce, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Produces an experimental masked circuit proof bound to explicit public commitment points. | |
| Result< bool > | purify::bppp::verify_experimental_circuit_zk_norm_arg_with_public_commitments (const NativeBulletproofCircuit &circuit, const ExperimentalCircuitZkNormArgProof &proof, std::span< const PointBytes > public_commitments, purify_secp_context *secp_context, std::span< const unsigned char > statement_binding={}, ExperimentalCircuitBackend *cache=nullptr) |
| Verifies an experimental masked circuit proof against explicit public commitment points. | |
| Result< CommittedPurifyWitness > | purify::bppp::commit_output_witness (const Bytes &message, const SecretKey &secret, const ScalarBytes &blind, purify_secp_context *secp_context) |
| Evaluates Purify, derives its witness, and commits to the output using Purify's default generators. | |
| Result< CommittedPurifyWitness > | purify::bppp::commit_output_witness (const Bytes &message, const SecretKey &secret, const ScalarBytes &blind, purify_secp_context *secp_context, const GeneratorBytes &value_gen, const GeneratorBytes &blind_gen) |
| Evaluates Purify, derives its witness, and commits to the output with explicit generators. | |
| purify_bppp_backend_resources* backend_resources = nullptr |
| std::vector<FieldElement> c_vec |
Definition at line 472 of file bppp.cpp.
Referenced by purify::bppp::commit_norm_arg_with_cache(), purify::bppp::prove_norm_arg_to_commitment_with_cache(), purify_bppp_commit_norm_arg_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_const(), purify_bppp_verify_norm_arg_impl(), purify_copy_vectors_into_scratch(), purify_norm_arg_commit_initial_data(), and purify::bppp::verify_norm_arg_with_cache().
| std::size_t generator_count = 0 |
Definition at line 344 of file bppp.cpp.
Referenced by purify_bulletproof_backend_resources_clone(), and purify_bulletproof_backend_resources_create().
| std::vector<PointBytes> generators |
Definition at line 471 of file bppp.cpp.
Referenced by purify::bppp::ExperimentalCircuitCache::clone_line_for_thread(), purify::bppp::commit_norm_arg_with_cache(), purify::bppp::generator_backend_cache_key(), purify::bppp::ExperimentalCircuitCache::get_or_create_backend_resources(), purify::bppp::prove_norm_arg_to_commitment_with_cache(), and purify_bppp_generators_clone().
| std::vector<FieldElement> l_vec |
Definition at line 487 of file bppp.cpp.
Referenced by purify::bppp::commit_norm_arg_with_cache(), purify::bppp::prove_norm_arg_to_commitment_with_cache(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_const(), and purify_copy_vectors_into_scratch().
| std::vector<FieldElement> n_vec |
Definition at line 486 of file bppp.cpp.
Referenced by purify::bppp::commit_norm_arg_with_cache(), purify::bppp::prove_norm_arg_to_commitment_with_cache(), purify_bppp_commit_norm_arg_impl(), purify_bppp_commit_witness_only_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_const(), and purify_copy_vectors_into_scratch().
| CircuitNormArgPublicDataPtr public_data |
Definition at line 485 of file bppp.cpp.
Referenced by purify::bppp::verify_experimental_circuit_norm_arg(), and purify::bppp::verify_experimental_circuit_zk_norm_arg_impl().
| FieldElement rho = FieldElement::zero() |
Definition at line 468 of file bppp.cpp.
Referenced by purify_bppp_commit_norm_arg_impl(), purify_bppp_prove_norm_arg_impl(), purify_bppp_prove_norm_arg_to_commitment_impl(), purify_bppp_rangeproof_norm_product_prove_const(), purify_bppp_verify_norm_arg_impl(), purify_norm_arg_commit_initial_data(), and secp256k1_bulletproof_relation66_prove_impl().