This repository contains zkSNARK circuit templates for basic divisibility properties of arbitrary field elements
- This was an educational project for me to learn how to implement custom circuit templates using Circom
Disclaimer: the circuit templates found in this repository have not been thoroughly tested, and should only remain for demonstrative purposes.
Check the /circuits
folder for the source code of the following templates
- Num2Digits
- Digits2Num
- Num2FirstNMinus1
- IsDivisibleBy2
- IsDivisibleBy3
- IsDivisibleBy4
- IsDivisibleBy5
- IsDivisibleBy6
- IsDivisibleBy7
- IsDivisibleBy8
- IsDivisibleBy9
In the ring of integers, there are many divisibility properties
- These properties hold not only in the ring of integers, but also in prime fields
Consider a prime field element
Property | Condition |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
where