Bit extraction
Overview
Extracting a specific bit
from concrete import fhe
@fhe.compiler({"x": "encrypted"})
def f(x):
return fhe.bits(x)[0], fhe.bits(x)[3]
inputset = range(32)
circuit = f.compile(inputset)
assert circuit.encrypt_run_decrypt(0b_00000) == (0, 0)
assert circuit.encrypt_run_decrypt(0b_00001) == (1, 0)
assert circuit.encrypt_run_decrypt(0b_01100) == (0, 1)
assert circuit.encrypt_run_decrypt(0b_01101) == (1, 1)Extracting multiple bits with slices
Bit extraction with signed integers
Use case example
Limitations
Performance considerations
A Chain of individual bit extractions
Reuse of Intermediate Extracted Bits
TLUs of 1b input precision
Last updated
Was this helpful?