arithmetic-circuits alternatives and similar packages
Based on the "Cryptography" category.
Alternatively, view arithmetic-circuits alternatives based on common mentions on social networks and blogs.
cryptonitelowlevel set of cryptographic primitives for haskell
lol9.6 0.0 arithmetic-circuits VS lolΛ ⚬ λ: Functional Lattice Cryptography
lol-apps9.6 0.0 arithmetic-circuits VS lol-appsΛ ⚬ λ: Functional Lattice Cryptography
merkle-treeAn implementation of a Merkle Tree and merkle tree proofs
jose9.4 3.2 arithmetic-circuits VS joseHaskell JOSE and JWT library
cacophony9.1 0.0 arithmetic-circuits VS cacophonyA Haskell library implementing the Noise protocol.
saltine9.0 0.0 arithmetic-circuits VS saltineCryptography that's easy to digest (NaCl/libsodium bindings)
pedersen-commitmentAn implementation of Pedersen commitment schemes
entropy8.9 0.0 arithmetic-circuits VS entropyEasy entropy source for Haskell users.
secp256k18.7 0.0 arithmetic-circuits VS secp256k1Haskell bindings for secp256k1 library
pvss8.7 0.0 arithmetic-circuits VS pvssPublic Verifiable Secret Sharing
galois-fieldFinite field and algebraic extension field arithmetic
aos-signatureAbe-Ohkubo-Suzuki Linkable Ring Signatures
crypto-rngCryptographic random number generator.
pairing8.5 0.0 arithmetic-circuits VS pairingOptimised bilinear pairings over elliptic curves
elliptic-curveA polymorphic interface for elliptic curve operations
cryptohashefficient and practical cryptohashing in haskell. DEPRECATED in favor of cryptonite
HsOpenSSL8.4 0.0 arithmetic-circuits VS HsOpenSSLOpenSSL binding for Haskell
oblivious-transferOblivious transfer for multiparty computation
jose-jwt8.3 0.0 arithmetic-circuits VS jose-jwtHaskell implementation of JOSE/JWT standards
cipher-blowfishDEPRECATED by cryptonite; A collection of cryptographic block and stream ciphers in haskell
signable8.1 0.0 arithmetic-circuits VS signableDeterministic serialisation and signatures with proto-lens and protobuf-elixir support
ed255198.1 0.0 L4 arithmetic-circuits VS ed25519Minimal ed25519 Haskell package, binding to the ref10 SUPERCOP implementation.
cipher-aes8.0 0.0 L4 arithmetic-circuits VS cipher-aesDEPRECATED - use cryptonite - a comprehensive fast AES implementation for haskell that supports aesni and advanced cryptographic modes.
crypto-apiHaskell generic interface (type classes) for cryptographic algorithms
crypto-sodiumHaskell cryptography done right
skein7.8 0.0 L3 arithmetic-circuits VS skeinSkein, a family of cryptographic hash functions. Includes Skein-MAC as well.
servant-hmac-authServant authentication with HMAC
galois-fftFinite field polynomial arithmetic based on fast Fourier transforms
qnap-decryptDecrypt files encrypted by the QNAP's Hybrid Backup Sync
cryptohash-sha256Fast, pure and practical SHA-256 implementation
pwstore-fastSecurely store hashed, salted passwords
spake27.2 0.0 arithmetic-circuits VS spake2SPAKE2 key exchange protocol for Haskell
cryptohash-md5Fast, pure and practical MD5 implementation
bcrypt7.1 0.0 L2 arithmetic-circuits VS bcryptHaskell bindings for bcrypt
h-gpgme7.0 0.0 arithmetic-circuits VS h-gpgmehighlevel bindings for gnupg made easy in haskell
crypto-pubkey-typesCrypto Public Key algorithm generic types.
xxhash7.0 0.0 L4 arithmetic-circuits VS xxhashHaskell implementation of the XXHash algorithm
crypto-pubkey-opensshOpenSSH keys decoder/encoder
scrypt6.8 0.0 L4 arithmetic-circuits VS scryptHaskell bindings to Colin Percival's scrypt implementation.
nonce6.8 0.0 arithmetic-circuits VS nonceGenerate cryptographic nonces.
crypto-pubkeyDEPRECATED - use cryptonite - Cryptographic public key related algorithms in haskell (RSA,DSA,DH,ElGamal)
cipher-aes1286.5 0.0 L4 arithmetic-circuits VS cipher-aes128Based on cipher-aes, but using a crypto-api interface and providing resulting IVs for each mode
OTP6.4 0.0 arithmetic-circuits VS OTPHaskell implementation of One-Time Passwords algorithms
cprng-aes6.3 0.0 arithmetic-circuits VS cprng-aesCrypto Pseudo Random Number Generator using AES in counter mode
crypto-enigmaA Haskell Enigma machine simulator with rich display and machine state details.
eccrypto6.2 0.0 arithmetic-circuits VS eccryptoElliptic Curve Cryptography for Haskell
keystore6.2 0.0 arithmetic-circuits VS keystorestoring secret things
magic-wormholeMagic Wormhole for Haskell
crypto-numbersDEPRECATED - use cryptonite - Cryptographic number related function and algorithms
Static code analysis for 29 languages.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of arithmetic-circuits or a related project?
An arithmetic circuit is a low-level representation of a program that consists of gates computing arithmetic operations of addition and multiplication, with wires connecting the gates.
This form allows us to express arbitrarily complex programs with a set of private inputs and public inputs whose execution can be publicly verified without revealing the private inputs. This construction relies on recent advances in zero-knowledge proving systems:
This library presents a low-level interface for building zkSNARK proving systems from higher-level compilers. This system depends on the following cryptographic dependenices.
- pairing - Optimised bilinear pairings over elliptic curves
- galois-field - Finite field arithmetic
- galois-fft - Finite field polynomial arithmetic based on fast Fourier transforms
- elliptic-curve - Elliptic curve operations
- bulletproofs - Bulletproofs proof system
- arithmoi - Number theory operations
- semirings - Algebraic semirings
- poly - Efficient polynomial arithmetic
Towers of Finite Fields
This library can build proof systems polymorphically over a variety of pairing friendly curves. By default we use the BN254 with an efficient implementation of the optimal Ate pairing.
The Barreto-Naehrig (BN) family of curves achieve high security and efficiency with pairings due to an optimum embedding degree and high 2-adicity. We have implemented the optimal Ate pairing over the BN254 curve we define and as:
The tower of finite fields we work with is defined as:
An arithmetic circuit over a finite field is a directed acyclic graph with gates as vertices and wires and edges. It consists of a list of multiplication gates together with a set of linear consistency equations relating the inputs and outputs of the gates.
Let be a finite field and a map that takes arguments as inputs from and outputs l elements in . The function C is an arithmetic circuit if the value of the inputs that pass through wires to gates are only manipulated according to arithmetic operations + or x (allowing constant gates).
Let , , respectively denote the input, witness and output size and be the number of all inputs and outputs of the circuit A tuple , is said to be a valid assignment for an arithmetic circuit C if .
Quadratic Arithmetic Programs (QAP)
QAPs are encodings of arithmetic circuits that allow the prover to construct a proof of knowledge of a valid assignment for a given circuit .
A quadratic arithmetic program (QAP) contains three sets of polynomials in :
and a target polynomial .
In this setting, an assignment is valid for a circuit if and only if the target polynomial divides the polynomial:
Logical circuits can be written in terms of the addition, multiplication and negation operations.
DSL and Circuit Builder Monad
Any arithmetic circuit can be built using a domain specific language to construct circuits that lives inside [Lang.hs](src/Circuit/Lang.hs).
```haskell ignore type ExprM f a = State (ArithCircuit f, Int) a execCircuitBuilder :: ExprM f a -> ArithCircuit f
```haskell ignore -- | Binary arithmetic operations add, sub, mul :: Expr Wire f f -> Expr Wire f f -> Expr Wire f f
```haskell ignore -- | Binary logic operations -- Have to use underscore or similar to avoid shadowing @[email protected] and @[email protected] -- from Prelude/Protolude. and_, or_, xor_ :: Expr Wire f Bool -> Expr Wire f Bool -> Expr Wire f Bool
```haskell ignore -- | Negate expression not_ :: Expr Wire f Bool -> Expr Wire f Bool
```haskell ignore -- | Compare two expressions eq :: Expr Wire f f -> Expr Wire f f -> Expr Wire f Bool
```haskell ignore -- | Convert wire to expression deref :: Wire -> Expr Wire f f
```haskell ignore -- | Return compilation of expression into an intermediate wire e :: Num f => Expr Wire f f -> ExprM f Wire
```haskell ignore -- | Conditional statement on expressions cond :: Expr Wire f Bool -> Expr Wire f ty -> Expr Wire f ty -> Expr Wire f ty
```haskell ignore -- | Return compilation of expression into an output wire ret :: Num f => Expr Wire f f -> ExprM f Wire
The following program represents the image of the arithmetic circuit [above](#arithmetic-circuits-1). ```haskell ignore program :: ArithCircuit Fr program = execCircuitBuilder (do i0 <- fmap deref input i1 <- fmap deref input i2 <- fmap deref input let r0 = mul i0 i1 r1 = mul r0 (add i0 i2) ret r1)
The output of an arithmetic circuit can be converted to a DOT graph and save it as SVG.
```haskell ignore dotOutput :: Text dotOutput = arithCircuitToDot (execCircuitBuilder program)
<p> <img src=".assets/arithmetic-circuit-example.svg" width="250"/> </p> ## Example We'll keep taking the program constructed with our DSL as example and will use the library [pairing](https://www.github.com/adjoint-io/pairing) that provides a field of points of the BN254 curve and precomputes primitive roots of unity for binary powers that divide <img src="/tex/580e7a6446bf50562e34247c545883a2.svg?invert_in_darkmode&sanitize=true" align=middle width=36.18335654999999pt height=21.18721440000001pt/>. ```haskell import Protolude import qualified Data.Map as Map import Data.Pairing.BN254 (Fr, getRootOfUnity) import Circuit.Arithmetic import Circuit.Expr import Circuit.Lang import Fresh (evalFresh, fresh) import QAP program :: ArithCircuit Fr program = execCircuitBuilder (do i0 <- fmap deref input i1 <- fmap deref input i2 <- fmap deref input let r0 = mul i0 i1 r1 = mul r0 (add i0 i2) ret r1)
We need to generate the roots of the circuit to construct polynomials and that satisfy the divisibility property and encode the circuit to a QAP to allow the prover to construct a proof of a valid assignment.
We also need to give values to the three input wires to this arithmetic circuit.
roots :: [[Fr]] roots = evalFresh (generateRoots (fmap (fromIntegral . (+ 1)) fresh) program) qap :: QAP Fr qap = arithCircuitToQAPFFT getRootOfUnity roots program inputs :: Map.Map Int Fr inputs = Map.fromList [(0, 7), (1, 5), (2, 4)]
A prover can now generate a valid assignment.
assignment :: QapSet Fr assignment = generateAssignment program inputs
The verifier can check the divisibility property of by for the given circuit.
main :: IO () main = do if verifyAssignment qap assignment then putText "Valid assignment" else putText "Invalid assignment"
This is experimental code meant for research-grade projects only. Please do not use this code in production until it has matured significantly.
Copyright (c) 2017-2020 Adjoint Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*Note that all licence references and agreements mentioned in the arithmetic-circuits README section above are relevant to that project's source code only.