This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Hash import keccak | |
p = 0x800000000000011000000000000000000000000000000000000000000000001 | |
r = 2^256 | |
# Example 1 | |
# AIR: Fibonacci 2 columns | |
# Blow up factor = 2 | |
# Queries = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2023 StarkWare Industries Ltd. | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"). | |
// You may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// https://www.starkware.co/open-source-license/ | |
// | |
// Unless required by applicable law or agreed to in writing, | |
// software distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM rustlang/rust:nightly as builder | |
# Compile the sandstorm prover. | |
COPY . ./app | |
WORKDIR /app | |
RUN cargo build --release | |
# Install Python3.9 and Cairo dependencies. | |
RUN apt-get update \ | |
&& apt-get install -y python3.9 python3.9-venv python3.9-dev python3-pip libgmp3-dev \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate sha3; | |
use sha3::{Digest, Keccak256}; | |
use lambdaworks_math::{unsigned_integer::element::U256, traits::ByteConversion, field::{fields::fft_friendly::stark_252_prime_field::Stark252PrimeField, element::FieldElement}}; | |
const MODULUS: U256 = U256::from_hex_unchecked("800000000000011000000000000000000000000000000000000000000000001"); | |
const R_MONTGOMERY: U256 = U256::from_hex_unchecked("7fffffffffffdf0ffffffffffffffffffffffffffffffffffffffffffffffe1"); | |
const MODULUS_MAX_MULTIPLE: U256 = U256::from_hex_unchecked("f80000000000020f00000000000000000000000000000000000000000000001f"); | |
const R_INV: U256 = U256::from_hex_unchecked("0x40000000000001100000000000012100000000000000000000000000000000"); | |
fn keccak_hash(data: &[u8]) -> Keccak256 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.Hash import keccak | |
MODULUS = 0x800000000000011000000000000000000000000000000000000000000000001 | |
R_MONTGOMERY = 0x7fffffffffffdf0ffffffffffffffffffffffffffffffffffffffffffffffe1 | |
# This is the max multiple that enters in the big int representation, used for | |
# uniform sampling over the finite field. | |
MODULUS_MAX_MULTIPLE = 0xf80000000000020f00000000000000000000000000000000000000000000001f | |
def keccak_hash(data): |