Skip to main content

Input & Encryption

To create an encrypted value, use new_euint128 or new_ebool with client-encrypted ciphertext.

Creating Encrypted Values (Program Side)

Input Functions

The last parameter in new_euint128/new_ebool identifies whether the input is ciphertext (0) or plaintext (1). Always pass 0 when working with client-encrypted data.

Trivial Encryption

Use as_euint128 and as_ebool to convert plaintext values to encrypted handles directly in your program. This is useful for constants or program-generated values.
Trivial encryption should only be used for public constants (like zero) or values that don’t need to be secret. For user-provided sensitive values, always use client-side encryption with new_euint128.

Client-Side Encryption

Values must be encrypted client-side before sending to your program. Use the JavaScript SDK to encrypt values:
See the JavaScript SDK Encryption documentation for supported types and error handling.