`ConstantTime.Choice`

— Type`ConstantTime.Selectable`

— Type`ConstantTime.Value`

— Type```
Value{T}(value::T)
Value(value::T)
```

A wrapper for a type `T`

that protects it from being used in non-constant-time operations.

This module defines some methods that are (most probably) constant-time. Namely, for built-in integer types (`Int8...128`

and `UInt8...128`

), the following methods are defined: `zero`

, `one`

, `~`

, `+`

, `-`

, `xor`

, `&`

, `|`

, `%`

(with the second argument being a built-in integer type), `signed`

, `unsigned`

, `iseven`

, `isodd`

, `iszero`

, `==`

. Also, `>>`

and `<<`

are defined for the shift also being a built-in integer.

The functions that would otherwise return `Bool`

will return `Choice`

for `Value`

objects.

Binary operations on one `Value`

and one unwrapped value produce a `Value`

.

`Base.get`

— Method`get(array::Array{Value{V}, 1}, x::Value, default::Value{V}) where V <: Selectable`

Constant-time array access.

`ConstantTime.select`

— Method```
select(choice::Bool, x, y)
select(choice::Choice, x::Value{T}, y::Value{T})
```

An analogue of a ternary operator or `ifelse`

(which, at the moment, cannot have methods added to them).

If `choice`

is `true`

, returns `x`

, else `y`

. For `choice`

being a `Choice`

object, and `x`

and `y`

being `Value`

objects, the operation is constant-time.

`ConstantTime.swap`

— Method`ConstantTime.unwrap`

— Method```
unwrap(x)
unwrap(x::Value)
```

If `x`

is a `Value`

, returns the wrapped value. Otherwise, returns `x`

.

`ConstantTime.unwrap_choice`

— Method`unwrap(x::Choice)`

Returns the wrapped boolean value.

Not constant-time.

`ConstantTime.wrap`

— Method