{"_id":"@crema-labs/aes-circom","_rev":"1-688e47eff733c047e8024ed6a06a2a72","name":"@crema-labs/aes-circom","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@crema-labs/aes-circom","version":"0.0.1","keywords":["aes","cipher","circom","circuit","zk","zk-snarks"],"license":"MIT","_id":"@crema-labs/aes-circom@0.0.1","maintainers":[{"name":"immabeyeet","email":"coarse.00baggage@icloud.com"},{"name":"vikas_rushi","email":"vikasrushi@outlook.com"},{"name":"aymanm","email":"aymanshaik1015@gmail.com"}],"contributors":[{"name":"Ayman Mohammed","email":"aymanshaik1015@gmail.com"},{"name":"Vikas Rushi","email":"0xvikas@gmail.com"},{"name":"Yashwant Reddy","email":"yashdotreddy@gmailcom"}],"homepage":"https://github.com/crema-labs/aes-circom#readme","bugs":{"url":"https://github.com/crema-labs/aes-circom/issues"},"dist":{"shasum":"27f88fe65ccde3e160a4bb6a6099a1f53b8c5cdf","tarball":"https://registry.npmjs.org/@crema-labs/aes-circom/-/aes-circom-0.0.1.tgz","fileCount":27,"integrity":"sha512-ZGUxF3o2M0/HXHTvsJWwJ/D42wq9af8r83x1xBnzgsebIqQC8lYvVSqzd7sIXevUYqZYxr+EgBmyng9/OZkHnQ==","signatures":[{"sig":"MEQCIGb6fnfDvtQr8rp4zzcL6bdy1TV1CH56fvSkM9Mdrx7YAiBObOwkIOQ50+WV8mdhPOvODElmHS3SnElJfmhDOFEIqg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":68821},"main":"index.js","gitHead":"00fb36e6fe1bd9f9af42da11ebe5231a8ed0decb","scripts":{"test":"npx mocha","start":"npx ts-node ./src/index.ts","compile:test":"npx circomkit compile cipher_4 && npx circomkit prove cipher_4 default && npx circomkit verify cipher_4 default"},"_npmUser":{"name":"aymanm","email":"aymanshaik1015@gmail.com"},"repository":{"url":"git+https://github.com/crema-labs/aes-circom.git","type":"git"},"_npmVersion":"9.6.7","description":"A generic AES forward cipher implementation","directories":{},"_nodeVersion":"18.17.1","dependencies":{"circomkit":"^0.0.22","circomlib":"^2.0.5"},"_hasShrinkwrap":false,"devDependencies":{"mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^5.1.3","@types/node":"^20.3.0","@types/mocha":"^10.0.1"},"_npmOperationalInternal":{"tmp":"tmp/aes-circom_0.0.1_1722691801314_0.8033852370743149","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@crema-labs/aes-circom","description":"A generic AES forward cipher implementation","version":"0.0.2","main":"index.js","keywords":["aes","cipher","circom","circuit","zk","zk-snarks"],"scripts":{"start":"npx ts-node ./src/index.ts","test":"npx mocha","compile:test":"npx circomkit compile cipher_4 && npx circomkit prove cipher_4 default && npx circomkit verify cipher_4 default"},"dependencies":{"circomkit":"^0.0.22","circomlib":"^2.0.5"},"repository":{"type":"git","url":"git+https://github.com/crema-labs/aes-circom.git"},"contributors":[{"name":"Ayman Mohammed","email":"aymanshaik1015@gmail.com"},{"name":"Vikas Rushi","email":"0xvikas@gmail.com"},{"name":"Yashwant Reddy","email":"yashdotreddy@gmailcom"}],"license":"MIT","devDependencies":{"@types/mocha":"^10.0.1","@types/node":"^20.3.0","mocha":"^10.2.0","ts-node":"^10.9.1","typescript":"^5.1.3"},"gitHead":"00fb36e6fe1bd9f9af42da11ebe5231a8ed0decb","bugs":{"url":"https://github.com/crema-labs/aes-circom/issues"},"homepage":"https://github.com/crema-labs/aes-circom#readme","_id":"@crema-labs/aes-circom@0.0.2","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-KrGq4clLVMhlaQFzFxUClnO4Jw4tRSGBB/a/8TJ5il4rshBJbDwcWHE/wvxNy99xelqbxKlbYjfEHyc/qn2BoA==","shasum":"1da9bc005863d3706d654ba6817baeb194a5b2e8","tarball":"https://registry.npmjs.org/@crema-labs/aes-circom/-/aes-circom-0.0.2.tgz","fileCount":12,"unpackedSize":34700,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5E2cePtiOTOdjEtn2KhW8cNAaxh8JPBZXQrT4wfuVvgIgAUWE8cIO8HwV5YmKROwWyINLEfZ9BEOFNbCo9KfSa18="}]},"_npmUser":{"name":"aymanm","email":"aymanshaik1015@gmail.com"},"directories":{},"maintainers":[{"name":"immabeyeet","email":"coarse.00baggage@icloud.com"},{"name":"vikas_rushi","email":"vikasrushi@outlook.com"},{"name":"aymanm","email":"aymanshaik1015@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aes-circom_0.0.2_1722692249238_0.9737437308219103"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-03T13:30:01.205Z","modified":"2024-08-03T13:37:29.742Z","0.0.1":"2024-08-03T13:30:01.481Z","0.0.2":"2024-08-03T13:37:29.463Z"},"bugs":{"url":"https://github.com/crema-labs/aes-circom/issues"},"license":"MIT","homepage":"https://github.com/crema-labs/aes-circom#readme","keywords":["aes","cipher","circom","circuit","zk","zk-snarks"],"repository":{"type":"git","url":"git+https://github.com/crema-labs/aes-circom.git"},"description":"A generic AES forward cipher implementation","contributors":[{"name":"Ayman Mohammed","email":"aymanshaik1015@gmail.com"},{"name":"Vikas Rushi","email":"0xvikas@gmail.com"},{"name":"Yashwant Reddy","email":"yashdotreddy@gmailcom"}],"maintainers":[{"name":"immabeyeet","email":"coarse.00baggage@icloud.com"},{"name":"vikas_rushi","email":"vikasrushi@outlook.com"},{"name":"aymanm","email":"aymanshaik1015@gmail.com"}],"readme":"# aes-circom\n\nThis repository contains generic implementation for AES encryption in Circom.\n\n## AES\n\nAES is a symmetric encryption algorithm that was established by the U.S. National Institute of Standards and Technology (NIST) in 2001. It is a subset of the Rijndael block cipher. AES has a fixed block size of 128 bits and a key size of 128, 192, or 256 bits. The algorithm is based on a design principle known as a substitution-permutation network (SPN).\nRead more about AES here := [FIPS 197](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.197-upd1.pdf).\nSimple Rust implementation of AES can be found here := [tinyaes](https://docs.rs/crate/tinyaes/latest/source/src/aes_core.rs)\n\n## Circuit\n\nThe circuits contain components for AES forward encryption. The implementation strictly follows the AES standard mentioned in the FIPS 197 document. The circuit is designed to be generic and can be used for any key size (128, 192, 256 bits) and block size (128 bits).\n\nCheck the [Cipher](https://github.com/crema-labs/aes/blob/main/circuits/cipher.circom) and [KeyExpansion](https://github.com/crema-labs/aes/blob/main/circuits/key_expansion.circom) circuits for visual representation of the design.\n\n### Constraints\n\nThe following constraint values were calculated using \n```sh\ncircom -l node_modules ./circuits/main/cipher_4.circom -o build --r1cs --wasm                    \n```\n\n<img width=\"282\" alt=\"contraints\" src=\"https://github.com/user-attachments/assets/f9f13742-321a-4a1e-9676-f125e2aaf2ee\">\n\n## Design Decisions\n\nThe circuit only support the forward encryption of AES as we believe that the proof of computation for any proprietary use case can be refactored to use the forward encryption instead of the decryption. \n\n 💡 Create an issue if you think that the decryption circuit is necessary.\n\n## Circomkit\n\nIn this repository, we are using [Circomkit](https://github.com/erhant/circomkit) to test some example circuits using Mocha. The circuits and the statements that they prove are as follows:\n\n### Configuration\n\nCircomkit checks for `circomkit.json` to override it's default configurations. We could for example change the target version, prime field and the proof system by setting `circomkit.json` to be:\n\n```json\n{\n  \"version\": \"2.1.8\",\n  \"protocol\": \"plonk\",\n  \"prime\": \"bls12381\"\n}\n```\n\n### Testing\n\nYou can use the following commands to test the circuits:\n\n```sh\n# test everything\nyarn test\n\n# test a specific circuit\nyarn test -g <template-name>\n```\n\n## Roadmap\n\n- [x] AES Forward Encryption Circuit\n- [ ] Add AES-CTR mode (priority for ECIES implementaion)\n- [ ] Add all other modes adhering to [NIST standards](https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf)\n\n## Contribution\n\nFeel free to contribute to this repository by creating issues or pull requests. We are open to any suggestions or improvements.\n","readmeFilename":"README.md"}