### Syntax Highlighting Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Illustrates code with syntax highlighting using a Go example. ```go package main import ( "bytes" "fmt" "github.com/alecthomas/chroma-go/v2/formatters/html" "github.com/alecthomas/chroma-go/v2/lexers" "github.com/alecthomas/chroma-go/v2/styles" ) func main() { input := `var foo = "bar";` lexer := lexers.Get("javascript") iterator, _ := lexer.Tokenise(nil, input) style := styles.Get("github") formatter := html.New(html.WithLineNumbers()) var buff bytes.Buffer formatter.Format(&buff, style, iterator) fmt.Println(buff.String()) } ``` -------------------------------- ### Install Dependencies on Ubuntu/Debian Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/_index.md Installs necessary development libraries for Ubuntu and Debian-based systems. ```bash $ sudo apt install libssl-dev libzstd-dev libgtest-dev libbenchmark-dev zlib1g-dev ``` -------------------------------- ### Install Dependencies on Fedora/Redhat Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/_index.md Installs necessary development libraries for Fedora and Redhat-based systems. ```bash $ yum install -y clang libzstd-devel openssl-devel git cmake google-benchmark-devel gtest-devel ``` -------------------------------- ### Definition List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Shows how to create a definition list. ```markdown Name : Godzilla Born : 1952 Birthplace : Japan Color : Green ``` -------------------------------- ### Unordered List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Shows how to create an unordered list. ```markdown * Liverpool F.C. * Chelsea F.C. * Manchester United F.C. ``` -------------------------------- ### Go Syntax Highlighting Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/blog/news/second-post.md Demonstrates Go code with syntax highlighting. Requires lexers and styles packages. ```go func main() { input := `var foo = "bar";` lexer := lexers.Get("javascript") iterator, _ := lexer.Tokenise(nil, input) style := styles.Get("github") formatter := html.New(html.WithLineNumbers()) var buff bytes.Buffer formatter.Format(&buff, style, iterator) fmt.Println(buff.String()) } ``` -------------------------------- ### Install Dependencies on MacOS Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/_index.md Installs necessary development libraries using Homebrew on MacOS. Ensure Xcode command line tools are installed. ```bash $ brew install googletest google-benchmark zstd ``` -------------------------------- ### OpenID4VP DCQL zk_system_type Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/zk-system-spec.md An example of a correctly filled zk_system_type for requesting an ISO mDL via OpenID4VP using the mso_mdoc_zk format. This structure specifies the Zero-Knowledge Proof system details. ```json "zk_system_type": [ { "id": "137e5a75ce72735a37c8a72da1a8a0a5df8d13365c2ae3d2c2bd6a0e7197c7c6" "system": "longfellow-libzk-v1", "circuit_hash":"137e5a75ce72735a37c8a72da1a8a0a5df8d13365c2ae3d2c2bd6a0e7197c7c6", "num_attributes": 1, "version": 6, "block_enc_hash": 4025, "block_enc_sig": 2945, } ], ``` -------------------------------- ### Ordered List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Illustrates the creation of an ordered list. ```markdown 1. Michael Brecker 2. Seamus Blake 3. Branford Marsalis ``` -------------------------------- ### Example SmallTest Data (3 SHA blocks) Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/small__examples_8h_source.html An example initialization of the SmallTest structure, representing data that requires 3 SHA blocks for credential processing. This is used for testing specific scenarios. ```cpp { StaticString( "0x298aa30b14298b8bdb5b2b1cc0150e84a86a1469fa813f8df0f0bd09d8489661"), StaticString( "0x2f821d00395d0c63b222a8613c7af5f5cb2b655dda6c3926af7ea3acd6a05fba"), StaticString( "0xc96b7605f15536877592c24d4d65066a377c34e3e6a624ea52ce9d899207"), StaticString( "0xaca1128a3460368caefc5c24a27a7f9e8cc8d590b93485db2c408d1ac96d80ae"), StaticString( "0x08ca78156b6c60c711e501641d4b5000f1ff7715386f1186ce4aec1d6eb2ba92"), StaticString( "0xfdcb8d4da84f1dc03a7bd22909a6bcc103281310f9fe1fb97c13e5d2eb6934df"), {0x60, 0x80, 0xf3, 0x09, 0x55, 0x56, 0xe5, 0x21, 0x4c, 0x5f, 0xff, 0x7c, 0x6d, 0x3d, 0xcb, 0x90, 0x3e, 0x2d, 0xcc, 0x45, 0x42, 0x9c, 0x4d, 0x81, 0xf9, 0x80, 0x8d, 0x5e, 0x7a, 0xd2, 0x14, 0x50}, 32, (uint8_t *)"20241005", 183, {0x45, 0x72, 0x69, 0x6b, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x39, 0x38, 0x30, 0x30, 0x31, 0x30, 0x31, 0x00, 0xf5, 0xf5, 0xf5, 0xf5, 0xf4, 0xf4, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x32, 0x30, 0x32, 0x34, 0x31, 0x30, 0x30, 0x31, 0x32, 0x30, 0x32, 0x35, 0x31, 0x30, 0x30, 0x31, 0x3c, 0xeb, 0x4a, 0xec, 0x0d, 0x76, 0xbb, 0x50, 0x35, 0x09, 0xc6, 0x46, 0xad, 0xc6, 0x30, 0x3f, 0xb9, 0xea, 0xa5, 0x84, 0xb4, 0x8f, 0xa0, 0xbe, 0x07, 0x6f, 0x14, 0x28, 0xe4, 0xec, 0x3b, 0x37, 0x77, 0x91, 0x61, 0xbe, 0xb9, 0x86, 0x90, 0xfb, 0xc8, 0xe3, 0x57, 0x5a, 0x9d, 0xd9, 0x41, 0x91, 0xae, 0x8e, 0x4d, 0xbe, 0x2c, 0x44, 0x39, 0x07, 0x69, 0xea, 0x0c, 0x08, 0x80, 0x22, 0xf2, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}}, // The next examples requires 4 SHA blocks for the credential. { ``` -------------------------------- ### Install Dependencies on Ubuntu/Debian Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/md__r_e_a_d_m_e.html Installs necessary packages for building the Longfellow ZK library on Ubuntu or Debian-based systems. ```bash sudo apt install -y clang cmake libssl-dev libzstd-dev libgtest-dev libbenchmark-dev zlib1g-dev ``` -------------------------------- ### Install Dependencies on MacOS Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/md__r_e_a_d_m_e.html Installs necessary packages for building the Longfellow ZK library on MacOS using Homebrew. Ensure Xcode command line tools are installed. ```bash brew install googletest google-benchmark zstd ``` -------------------------------- ### Go Syntax Highlighting Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/getting-started/example-page.md An example of Go code with syntax highlighting, demonstrating lexer and formatter usage. ```go package main import ( "bytes" "fmt" "github.com/alecthomas/chroma/formatters/html" "github.com/alecthomas/chroma/lexers" "github.com/alecthomas/chroma/styles" ) func main() { input := `var foo = "bar";` lexer := lexers.Get("javascript") iterator, _ := lexer.Tokenise(nil, input) style := styles.Get("github") formatter := html.New(html.WithLineNumbers()) var buff bytes.Buffer formatter.Format(&buff, style, iterator) fmt.Println(buff.String()) } ``` -------------------------------- ### Unordered Task List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Demonstrates an unordered task list with completed items. ```markdown - [x] Create a Hugo theme - [x] Add task lists to it - [ ] Take a vacation ``` -------------------------------- ### Run Verifier Server Source: https://github.com/google/longfellow-zk/blob/main/reference/verifier-service/server/README.md Start the compiled server binary and provide the path to the circuits directory. The server will load the circuits and begin listening. ```bash ./server -circuit_dir ../../../lib/circuits/mdoc/circuits ``` -------------------------------- ### Setup Ligero Quadratic Constraints Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/zk__common_8h_source.html Sets up the Ligero quadratic constraints based on the circuit's proof pad layout. ```cpp static void setup_lqc(const Circuit& C, std::vector& lqc, size_t start_pad) { size_t pi = start_pad; for (size_t i = 0; i < C.nl; ++i) { PadLayout pl(C.l[i].logw); lqc[i].x = pi + pl.claim_pad(0); lqc[i].y = pi + pl.claim_pad(1); lqc[i].z = pi + pl.claim_pad(2); pi += pl.layer_size(); } } ``` -------------------------------- ### Example SmallTest Data (4 SHA blocks) Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/small__examples_8h_source.html An example initialization of the SmallTest structure, representing data that requires 4 SHA blocks for credential processing. This is used for testing larger credential data. ```cpp StaticString("0x08a25115e57d680260aafa44e674d45d43af885fffa6746b44ece71" "cd42febd2"), StaticString("0x4a177f6c38543876c66573218db63de627d343f16a483a313069830" "37df79b2f"), StaticString("0x95394343021474ed688e7e783063c768a3343def0f1245f1da0940" "34eb57410"), StaticString("0x4953b2f11cd46c8e1673ac50ddc51665702a27e5788eca3a8bffa67" "fbdbf65ce"), StaticString("0x1ca6eef3238ec5320429774f6b6b743cc868b3cfebff96c41112b36" "5638a9dc5"), StaticString("0x7e303bd730d0e663621ddcaf52991ba9f744cabe161598a44b4508f" "de7bdaf2d"), {0x60, 0x80, 0xf3, 0x09, 0x55, 0x56, 0xe5, 0x21, 0x4c, 0x5f, 0xff, 0x7c, 0x6d, 0x3d, 0xcb, 0x90, 0x3e, 0x2d, 0xcc, 0x45, 0x42, 0x9c, 0x4d, 0x81, 0xf9, 0x80, 0x8d, 0x5e, 0x7a, 0xd2, 0x14, 0x50}, 32, ``` -------------------------------- ### Install Dependencies on Fedora/Redhat Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/md__r_e_a_d_m_e.html Installs necessary packages for building the Longfellow ZK library on Fedora or Red Hat-based systems. ```bash yum install -y clang libzstd-devel openssl-devel git cmake google-benchmark-devel gtest-devel ``` -------------------------------- ### Basic Table Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Demonstrates a simple table structure. ```markdown | What | Follows | |-----------------|-----------------| | A table | A header | | A table | A header | | A table | A header | ``` -------------------------------- ### Inline Code Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/task.md Demonstrates how to display code inline using backticks. ```markdown `var foo = "bar";` ``` ```markdown `this should vertically align` ``` ```markdown `with this` ``` ```markdown `and this` ``` -------------------------------- ### ZkSystemSpec CBOR Example Source: https://context7.com/google/longfellow-zk/llms.txt Example structure for ZkSystemSpec in CBOR format, used when interacting with the ISO 18013-5 second edition protocol. Values should be sourced from kZkSpecs. ```json { "zkSystemId": "f88a39e561ec0be02bb3dfe38fb609ad154e98decbbe632887d850fc612fea6f", "system": "longfellow-libzk-v1", "params": { "circuit_hash": "f88a39e561ec0be02bb3dfe38fb609ad154e98decbbe632887d850fc612fea6f", "num_attributes": 1, "version": 5, "block_enc_hash": 4025, "block_enc_sig": 2945 } } ``` -------------------------------- ### Install Build Dependencies on Ubuntu/Debian Source: https://github.com/google/longfellow-zk/blob/main/README.md Installs the necessary build dependencies for Longfellow ZK on Ubuntu and Debian-based systems. Ensure you have sudo privileges. ```bash $ sudo apt install -y clang cmake libssl-dev libzstd-dev libgtest-dev libbenchmark-dev zlib1g-dev ``` -------------------------------- ### Inline Code Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/getting-started/example-page.md Demonstrates how to display inline code using backticks. ```plaintext var foo = "bar"; ``` ```plaintext this should vertically align ``` ```plaintext with this ``` ```plaintext and this ``` -------------------------------- ### ISO 18013-5 ZkSystemSpec Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/zk-system-spec.md An example of a correctly filled ZkSystemSpec object as defined in ISO 18013-5 section 10.2.7. This structure is used for Zero-Knowledge Proof system specifications. ```json Spec1 = { "zkSystemId": "137e5a75ce72735a37c8a72da1a8a0a5df8d13365c2ae3d2c2bd6a0e7197c7c6" "system": "longfellow-libzk-v1", "params": { "circuit_hash":"137e5a75ce72735a37c8a72da1a8a0a5df8d13365c2ae3d2c2bd6a0e7197c7c6", "num_attributes": 1, "version": 6, "block_enc_hash": 4025, "block_enc_sig": 2945, } } ``` -------------------------------- ### Build Longfellow ZK Library with CMake Source: https://context7.com/google/longfellow-zk/llms.txt Instructions for installing dependencies and building the C++ library using CMake and clang++. Includes running tests. ```bash # Ubuntu / Debian — install dependencies sudo apt install -y clang cmake libssl-dev libzstd-dev libgtest-dev libbenchmark-dev zlib1g-dev # macOS — install dependencies brew install googletest google-benchmark zstd # Configure and build (Release) CXX=clang++ cmake -D CMAKE_BUILD_TYPE=Release -S lib -B clang-build-release \ --install-prefix ${PWD}/install cd clang-build-release && make -j 16 && ctest -j 16 ``` -------------------------------- ### Inline Code Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/porridge.md Demonstrates how to display code snippets inline using backticks. ```markdown Code snippets like `var foo = "bar";` can be shown inline. ``` ```markdown Also, `this should vertically align` ~~`with this`~~ ~~and this~~. ``` -------------------------------- ### Mixed Task List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Shows a mixed task list with an unknown item. ```markdown - [ ] Pack bags - ? - [ ] Travel! ``` -------------------------------- ### Initialize CMake Build for Release Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/md__r_e_a_d_m_e.html Initializes the CMake build system for a release configuration, specifying the source directory and build output directory. Installs the build to the specified prefix. ```bash CXX=clang++ cmake -D CMAKE_BUILD_TYPE=Release -S lib -B clang-build-release --install-prefix ${PWD}/install ``` -------------------------------- ### Basic Block Code Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/blog/news/second-post.md Use this for simple code blocks without syntax highlighting. ```plaintext foo := "bar"; bar := "foo"; ``` -------------------------------- ### setup_lqc Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/classproofs_1_1_zk_common.html Sets up the Ligero Quadratic Constraints for a given circuit. ```APIDOC ## setup_lqc ### Description Sets up the Ligero Quadratic Constraints for a given circuit. ### Signature `static void setup_lqc(const Circuit& C, std::vector& lqc, size_t start_pad)` ### Parameters * `C` (const Circuit&): The circuit definition. * `lqc` (std::vector&): Vector to store the Ligero Quadratic Constraints (output). * `start_pad` (size_t): The starting padding value. ``` -------------------------------- ### Basic Code Block Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/Ponycopters/configuring-ponycopters.md This is a basic code block example. It demonstrates a simple code structure. ```plaintext This is a code block following a header. ``` -------------------------------- ### Build and Run Reference Verifier HTTP Server (Local) Source: https://context7.com/google/longfellow-zk/llms.txt Builds and runs the Go HTTP server locally. Requires the C++ library to be installed first. Ensure the circuit directory and port are correctly specified. ```bash # Or build locally (requires the C++ library to be installed first) CXX=clang++ cmake -D CMAKE_BUILD_TYPE=Release -S lib -B build \ --install-prefix reference/verifier-service/install cd build && make install cd reference/verifier-service/server go build ./server -circuit_dir ../../../lib/circuits/mdoc/circuits \ -cacerts certs.pem \ -port :8888 # Output: {"time":"...","level":"INFO","msg":"Starting server","addr":":8888"} ``` -------------------------------- ### Build and Run Reference Verifier HTTP Server (Docker) Source: https://context7.com/google/longfellow-zk/llms.txt Builds and runs the Go HTTP server using Docker. This is the recommended method for setting up the verifier service. ```bash # Build via Docker (recommended) cd reference/verifier-service docker build -t zk -f Dockerfile ../.. docker run -it -p 8888:8888 zk ``` -------------------------------- ### Assert Input Starts at Correct Position Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/cbor_8h_source.html Verifies that the input data starts at the specified root position and that the total length is consistent. Ensures that padding bytes are correctly handled. ```cpp void assert_input_starts_at(size_t n, const vindex& jroot, const vindex& input_len, const [decode](structproofs_1_1_cbor_1_1decode.html) ds[/*n*/]) const { const Logic& L = l_; // shorthand L.assert1(L.vleq(input_len, n)); L.assert1(L.vlt(jroot, n)); auto tot = L.vadd(jroot, input_len); L.vassert_eq(tot, n); for (size_t i = 0; i < n; ++i) { L.assert0(L.lmul(&ds[i].bd.as_scalar, L.vlt(i, jroot))); } } ``` -------------------------------- ### Build Golang Verifier Server Source: https://github.com/google/longfellow-zk/blob/main/reference/verifier-service/server/README.md Compile the Golang backend server after building the ZK library. Navigate to the server directory within the repository. ```bash cd /reference/verifier-service/server $ go build ``` -------------------------------- ### Build and Run Verifier Service with Docker Source: https://github.com/google/longfellow-zk/blob/main/reference/verifier-service/server/README.md Use these commands to build the Docker image for the verifier service and then run it, exposing port 8888. ```bash cd /reference/verifier-service docker build -t zk -f Dockerfile ../.. ``` ```bash docker run -it -p 8888:8888 zk ``` -------------------------------- ### Build and Run circuit_maker Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/dir_526da5f91d7cbd4b4389f9db984516d8.html Use this command to build the circuit_maker program and then run it to generate circuit files. Specify the output directory and the number of attributes. ```bash blaze build -c opt privacy/proofs/zk/lib/circuits/mdoc/circuit_maker ``` ```bash blaze-bin/privacy/proofs/zk/lib/circuits/mdoc/circuit_maker \ --output_dir privacy/proofs/zk/lib/circuits/mdoc/circuits/ \ --num_attributes 4 ``` -------------------------------- ### MDOC Example Data Structure Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/mdoc__examples_8h_source.html This example demonstrates a complex MDOC data structure including various fields and their CBOR encoded values. It's intended for testing and understanding MDOC's data handling capabilities. ```cpp { StaticString("0xdc1c1f55cff4cd5c76cf4169278f7217667f86ee81d8669b63f2e19 bc12a0c9f"), StaticString("0x12355dd0385fed3bc33bedc9781b9aad47b33e4c24704b8d14288b1 b3cb45c28"), {0x83, 0xf6, 0xf6, 0x84, 0x71, 0x42, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x48, 0x61, 0x6e, 0x64, 0x6f, 0x76, 0x65, 0x72, 0x76, 0x31, 0x58, 0x20, 0xf9, 0x3e, 0xba, 0xc4, 0xce, 0x4d, 0x99, 0x01, 0xb9, 0xae, 0xa4, 0x72, 0x14, 0x5a, 0xe5, 0x42, 0x1f, 0x8f, 0xbe, 0xcb, 0xe5, 0xf0, 0x38, 0x96, 0x83, 0xf5, 0x9f, 0x08, 0xfc, 0xf9, 0x0e, 0x45, 0x58, 0x33, 0xa3, 0x63, 0x63, 0x61, 0x74, 0x01, 0x64, 0x74, 0x79, 0x70, 0x65, 0x01, 0x67, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0xa1, 0x67, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, 0x75, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x68, 0x6f, 0x73, 0x74, 0x3a, 0x38, 0x30, 0x38, 0x30, 0x58, 0x20, 0x3c, 0x79, 0x91, 0x4b, 0x7f, 0x81, 0xa1, 0xc2, 0x55, 0x8f, 0xc8, 0x16, 0x19, 0xdd, 0x4a, 0x07, 0x4d, 0x32, 0x14, 0x3e, 0x6c, 0xf6, 0x89, 0x5f, 0xe4, 0x7d, 0xa1, 0x56, 0xd1, 0xc5, 0xb0, 0xae}, 143, (uint8_t*)"2024-10-01T09:00:00Z", kMDLDocType, 3173, {0xa3, 0x67, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x63, 0x31, 0x2e, 0x30, 0x69, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x81, 0xa3, 0x67, 0x64, 0x6f, 0x63, 0x54, 0x79, 0x70, 0x65, 0x75, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x73, 0x6f, 0x2e, 0x31, 0x38, 0x30, 0x31, 0x33, 0x2e, 0x35, 0x2e, 0x31, 0x2e, 0x6d, 0x44, 0x4c, 0x6c, 0x69, 0x73, 0x73, 0x75, 0x65, 0x72, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0xa2, 0x6a, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x70, 0x61, 0x63, 0x65, 0x73, 0xa1, 0x71, 0x6f, 0x72, 0x67, 0x2e, 0x69, 0x73, 0x6f, 0x2e, 0x31, 0x38, 0x30, 0x31, 0x33, 0x2e, 0x35, 0x2e, 0x31, 0x85, 0xd8, 0x18, 0x58, 0x5a, 0xa4, 0x68, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x44, 0x18, 0x1a, 0x66, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x50, 0x72, 0xc7, 0xaf, 0x26, 0x49, 0xd0, 0x5a, 0x38, 0xb0, 0x2e, 0x7e, 0x1c, 0xc7, 0xf9, 0xd0, 0x46, 0x71, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x6b, 0x66, 0x61, 0x6d, 0x69, 0x6c, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x6a, 0x4d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x6d, 0x61, 0x6e, 0x6e, 0xd8, 0x18, 0x58, 0x5b, 0xa4, 0x68, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x44, 0x0a, 0x66, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x50, 0xfc, 0x8a, 0x8f, 0x5b, 0xaf, 0xb4, 0x0c, 0xb3, 0x21, 0x77, 0x6d, 0xbf, 0x5f, 0xbe, 0x18, 0x81, 0x71, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x6a, 0x62, 0x69, 0x72, 0x74, 0x68, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x6c, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0xd9, 0x03, 0xec, 0x6a, 0x31, 0x39, 0x37, 0x31, 0x2d, 0x30, 0x39, 0x2d, 0x30, 0x31, 0xd8, 0x18, 0x58, 0x5b, 0xa4, 0x68, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x44, 0x14, 0x66, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x50, 0x59, 0xcd, 0xdd, 0x91, 0xd7, 0x53, 0xed, 0x98, 0xff, 0x55, 0x5d, 0x2f, 0x97, 0x27, 0x45, 0x3b, 0x71, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x6a, 0x69, 0x73, 0x73, 0x75, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x6c, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0xd9, 0x03, 0xec, 0x6a, 0x32, 0x30, 0x32, 0x34, 0x2d, 0x30, 0x33, 0x2d, 0x31, 0x35, 0xd8, 0x18, 0x58, 0x4b, 0xa4, 0x68, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x49, 0x44, 0x0f, 0x66, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x50, 0xcc, 0xdc, 0x59, 0x8c, 0xa9, 0xaf, 0xee, 0x95, 0xfd, 0x57, 0x68, 0x3e, 0xb1, 0x9a, 0xff, 0x33, 0x71, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, } ``` -------------------------------- ### Nested List Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Illustrates a nested list structure. ```markdown * Jackson 5 * Michael * Tito * Jackie * Marlon * Jermaine * TMNT * Leonardo * Michelangelo * Donatello * Raphael ``` -------------------------------- ### ZK Prover: Sumcheck and Constraint Generation Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/zk__prover_8h_source.html This snippet demonstrates the core ZK prover logic, including running the sumcheck protocol to generate a padded proof, evaluating the circuit, and assembling constraints for the verifier. It involves initializing the Fiat-Shamir transcript, evaluating the circuit, and preparing auxiliary data for the proof. ```cpp ZkCommon::initialize_sumcheck_fiat_shamir(tsp, c_, W, f_); Transcript tst = tsp.clone(); // Run sumcheck to generate a padded proof. inputs in; auto V = super::eval_circuit(&in, &c_, W.clone(), f_); if (V == nullptr) { log(ERROR, "eval_circuit failed"); return false; } for (size_t i = 0; i < V->n1_; ++i) { if (V->v_[i] != f_.zero()) { log(ERROR, "V->v_[i] != F.zero()"); return false; }; } bindings bnd; ProofAux aux(c_.nl); TranscriptSumcheck tsts(tst, f_); super::prove(&zkp.proof, &pad_, &c_, in, &aux, bnd, tsts, f_); log(INFO, "ZK sumcheck done"); // 5. Simulate the verifier to assemble constraints on the committed vals. // Form the sparse matrix A and vector b such that A*w = b. std::vector> a; std::vector b; size_t ci = ZkCommon::verifier_constraints(c_, W, zkp.proof, &aux, a, b, tsp, n_witness_, f_); log(INFO, "ZK constraints done"); // 6. Produce proof over commitment. // For FS soundness, it is ok for hash_of_A to be any string. // In the interactive version, the verifier provides a challenge for the // com proof. The last prover message is the (wc_l,wc_r) pair, and this // has already been added to the transcript. const LigeroHash hash_of_A{0xde, 0xad, 0xbe, 0xef}; lp_->prove(zkp.com_proof, tsp, ci, a.size(), &a[0], hash_of_A, &lqc_[0], rsf_, f_); log(INFO, "Prover Done: flag"); return true; ``` -------------------------------- ### length Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/classproofs_1_1_cbor_doc.html Gets the length of the current CBOR data element. ```APIDOC ## length ### Description Returns the length of the current CBOR data element. ### Signature size_t length() const ### Returns size_t - The length of the current element. ``` -------------------------------- ### position Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/classproofs_1_1_cbor_doc.html Gets the current position within the CBOR data. ```APIDOC ## position ### Description Returns the current position within the CBOR data structure. ### Signature size_t position() const ### Returns size_t - The current position. ``` -------------------------------- ### assert_map_header Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/cbor_8h_source.html Asserts that a map starts at the position indicated by index `j`. ```APIDOC ## assert_map_header ### Description Asserts that a map starts at the position indicated by index `j`. ### Signature ```cpp void assert_map_header(size_t n, const vindex& j, const decode ds[/*n*/]) const ``` ### Parameters * `n` (size_t): The number of elements. * `j` (const vindex&): The index indicating the start of the map. * `ds` (const decode[]): An array of decoded CBOR elements. ``` -------------------------------- ### Run FFT Benchmarks Source: https://context7.com/google/longfellow-zk/llms.txt Execute benchmarks for Fast Fourier Transform (FFT) over various finite fields. Ensure you are in the 'clang-build-release' directory. ```bash cd clang-build-release # FFT benchmarks over various finite fields ./algebra/fft_test --benchmark_filter='BM_*' ``` -------------------------------- ### Constructor Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/classproofs_1_1_transcript.html Initializes a new Transcript object with initial data and version information. ```APIDOC ## Constructor ### Description Initializes a new Transcript object with initial data and version information. ### Signature Transcript(const uint8_t init[], size_t init_len, size_t version = 3) ### Parameters * **init** (const uint8_t[]) - The initial data for the transcript. * **init_len** (size_t) - The length of the initial data. * **version** (size_t) - The version of the transcript (defaults to 3). ``` -------------------------------- ### get Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/classproofs_1_1_transcript.html Retrieves a specific part of the transcript's internal state into a buffer. ```APIDOC ## get ### Description Retrieves a specific part of the transcript's internal state into a provided buffer. This function is often used to extract specific cryptographic elements or states. ### Signature void get(uint8_t key[]) ### Parameters * **key** (uint8_t[]) - The buffer to store the retrieved data. ``` -------------------------------- ### Wide Table Example Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/tasks/beds.md Demonstrates a table that requires horizontal scrolling due to its width. ```markdown | Artist | Album | Year | Label | Awards | Songs | |-------------------|-----------------|------|-------------|----------|-----------| | Michael Jackson | Thriller | 1982 | Epic Records | Grammy Award for Album of the Year, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Selling Album, Grammy Award for Best Engineered Album, Non-Classical | Wanna Be Startin' Somethin', Baby Be Mine, The Girl Is Mine, Thriller, Beat It, Billie Jean, Human Nature, P.Y.T. (Pretty Young Thing), The Lady in My Life | | Prince | Purple Rain | 1984 | Warner Brothers Records | Grammy Award for Best Score Soundtrack for Visual Media, American Music Award for Favorite Pop/Rock Album, American Music Award for Favorite Soul/R&B Album, Brit Award for Best Soundtrack/Cast Recording, Grammy Award for Best Rock Performance by a Duo or Group with Vocal | Let's Go Crazy, Take Me With U, The Beautiful Ones, Computer Blue, Darling Nikki, When Doves Cry, I Would Die 4 U, Baby I'm a Star, Purple Rain | | Beastie Boys | License to Ill | 1986 | Mercury Records | noawardsbutthistablecelliswide | Rhymin & Stealin, The New Style, She's Crafty, Posse in Effect, Slow Ride, Girls, (You Gotta) Fight for Your Right, No Sleep Till Brooklyn, Paul Revere, Hold It Now, Hit It, Brass Monkey, Slow and Low, Time to Get Ill | ``` -------------------------------- ### ZK Prover Test Case Source: https://github.com/google/longfellow-zk/blob/main/docs/static/reference/cpp/zk__testing_8h_source.html Sets up and runs a ZkProver test. It initializes factories, creates a ZkProof object, and uses a Transcript and SecureRandomEngine for the commit and prove operations. Expects the proof to be invalid in this specific test case. ```cpp using RSFactory = ReedSolomonFactory; const Field2 base_2(base); const Elt2 omega{root_x, root_y}; const FftExtConvolutionFactory fft(base, base_2, omega, root_order); const RSFactory rsf(fft, base); ZkProof zkpr(circuit, kLigeroRate, kLigeroNreq); Transcript tp((uint8_t*)"zk_test", 7, kVersion); SecureRandomEngine rng; ZkProver prover(circuit, base, rsf); prover.commit(zkpr, W, tp, rng); bool p_ok = prover.prove(zkpr, W, tp); EXPECT_FALSE(p_ok); ``` -------------------------------- ### Build and Run Circuit Maker Tool Source: https://github.com/google/longfellow-zk/blob/main/lib/circuits/mdoc/README.md Use this command to build and run the circuit_maker tool. This is typically done when gates have changed, and new hashes need to be produced. ```bash $ blaze build -c opt privacy/proofs/zk/lib/circuits/mdoc:circuit_maker $ blaze-bin/privacy/proofs/zk/lib/circuits/mdoc/circuit_maker --output_dir privacy/proofs/zk/lib/circuits/mdoc/circuits/ --num_attributes 1 ``` -------------------------------- ### Build and Test Project Source: https://github.com/google/longfellow-zk/blob/main/docs/content/en/docs/_index.md Compiles the project using make with parallel jobs and runs tests using ctest. ```bash $ cd clang-build-release && make -j 16 && ctest -j 16 ```