Inco exposes mathematical and logical operations over encrypted data.
Note that for each operation that takes 2 arguments (i.e binary types below), you can use either an e-type or a regular
variable as the first or second argument. Each operation returns a single e-type as result.
Under the hood, all operations are performing a call to the Inco contract singleton.
The Inco contract checks access control rules and emits an event for each operation
Example usage
euint256 a = e.asEuint256(2);
euint256 b = e.asEuint256(3);
euint256 c = a.add(b); // c = 5 (encrypted)
Supported math operations
All these operations return an euint256
.
Name | Function | Type |
---|
Addition | e.add | Binary |
Subtraction | e.sub | Binary |
Multiplication | e.mul | Binary |
Division | e.div | Binary |
Remainder | e.rem | Binary |
BitAnd | e.and | Binary |
BitOr | e.or | Binary |
BitXor | e.xor | Binary |
Shift Right | e.shr | Binary |
Shift Left | e.shl | Binary |
Rotate Right | e.rotr | Binary |
Rotate Left | e.rotl | Binary |
Supported comparison operations
Name | Function | Type | Returns |
---|
Equal | e.eq | Binary | ebool |
Not equal | e.ne | Binary | ebool |
Greater than or equal | e.ge | Binary | ebool |
Greater than | e.gt | Binary | ebool |
Less than or equal | e.le | Binary | ebool |
Less than | e.lt | Binary | ebool |
Min | e.min | Binary | euint256 |
Max | e.max | Binary | euint256 |
Not | e.not | Unary | ebool |
Generate a encrypted random number
euint256 randomNumber = e.rand();