import fr.ens.abricot.* fun main() val protocol = protocol val a = secretInput(party("Alice"), 42) val b = secretInput(party("Bob"), 117) val c = add(a, b) val result = reveal(c) output(result, party("Charlie"))
βββββββββββββββββββββββββββββββββββββββββββββββ β High-level DSL (Kotlin) β β protocol input(...) output(...) ... β βββββββββββββββββββββββββββββββββββββββββββββββ β βΌ βββββββββββββββββββββββββββββββββββββββββββββββ β Intermediate Representation β β (IR) β Linearized sequence of gates β βββββββββββββββββββββββββββββββββββββββββββββββ β βΌ βββββββββββββββββββββββββββββββββββββββββββββββ β Analysis Modules β β - Information flow β β - Leakage detection β β - Complexity estimation β βββββββββββββββββββββββββββββββββββββββββββββββ β βΌ βββββββββββββββββββββββββββββββββββββββββββββββ β Code Generation Backends β β - MP-SPDZ β β - SCALE-MAMBA (for ZK) β β - Custom networking stubs (Kotlin/Netty) β βββββββββββββββββββββββββββββββββββββββββββββββ | Feature | Abricot (Kotlin) | Circom (ZK-SNARKs) | MP-SPDZ high-level | |------------------------|------------------|--------------------|--------------------| | Host language | Kotlin (JVM) | Custom language | Python-like script | | Type system | Full Kotlin types + Secret | Static, signal-based | Dynamic | | Reusable sub-protocols | Yes (functions) | Yes (templates) | Yes (functions) | | Automatic malicious security | Partially via ZK insertion | No (must specify constraints) | Via compiler flags | | IDE support | Full (IntelliJ) | Limited | Limited | | Compilation target | MPC, ZK, simulation | R1CS + witness | Various MPC engines | 5. Example: Proactive Secret Sharing in Abricot One of the classic use cases for Abricot is proactive secret sharing β where shares are refreshed periodically to maintain security against mobile adversaries. abric-language-kotlin
1. What is Abricot? Abricot (not to be confused with the fruit "abricot" meaning apricot in French) is a research-oriented embedded DSL written in Kotlin. Its primary goal is to allow cryptographers and protocol designers to describe, analyze, and generate implementations of secure multiparty computation (MPC) protocols and zero-knowledge proofs (ZKPs) at a high level of abstraction. import fr
val protocol = protocol val x = input(alice) val y = input(bob) val z = add(x, y) output(z, charlie) Its primary goal is to allow cryptographers and
val proactiveRefresh = protocol val parties = listOf(p1, p2, p3) val oldShares = inputShares(parties) // Each party generates a random blinding share val randoms = parties.map randomShare()
// Not actual syntax but representative of Abricot style val secretSharing = protocol val s = secretInput(dealer, "secret") val shares = split(s, 3, 5) // 3-out-of-5 sharing send(shares[0] to alice) send(shares[1] to bob) // ...
// Locally refresh: new_share = old_share + random_share - random_share_from_prev val newShares = parties.indices.map i -> add(oldShares[i], randoms[i])
Debugging: The custom field value is: https://drive.google.com/file/d/10HhLFuKNRup_gLwSdHfbd2WzPmjEG9NV/view?usp=sharing