Abric-language-kotlin Better πŸ†• Pro

The name "Abricot" often appears in academic contexts related to , secret sharing , and verifiable secret sharing (VSS). The abricot-language-kotlin repository specifically provides a Kotlin-based frontend for writing cryptographic protocols that can later be compiled or interpreted for different backends (e.g., arithmetic circuits, Boolean circuits, or actual networking code).

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. abric-language-kotlin

// Locally refresh: new_share = old_share + random_share - random_share_from_prev val newShares = parties.indices.map i -> add(oldShares[i], randoms[i]) The name "Abricot" often appears in academic contexts

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 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. What is Abricot

// After receiving, subtract the incoming random receiveAll() val finalShares = parties.indices.map i -> val prev = (i - 1 + parties.size) % parties.size sub(newShares[i], randoms[prev])

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) // ...