Plain and encrypted levelled operation

If somebody could throw light on this " How is say addition between plain and encrypted values achieved
as in secret key scenario as we do homomorphic (levelled )operations( say addtiton) over two lwe cipher texts"
so in a deployment scenerio how do we ensure to operate on a lwe cipher text and unecrypted value( say on server side)

Hello. Sorry, your question went under the rdar, but better late than never. So, in Concrete, as a user, you don’t have to take care of the cryptography, everything is directly managed for you. So, here, as a user, you would write something like:

from concrete import fhe

def add(x, y):
    return x + y

compiler = fhe.Compiler(add, {"x": "encrypted", "y": "encrypted"})
inputset = [(2, 3), (0, 0), (1, 6), (7, 7), (7, 1), (3, 2), (6, 1), (1, 7), (4, 5), (5, 4)]

print(f"Compiling...")
circuit = compiler.compile(inputset)

print(f"Generating keys...")
circuit.keygen()

examples = [(3, 4), (1, 2), (7, 7), (0, 0)]
for example in examples:
    encrypted_example = circuit.encrypt(*example)
    encrypted_result = circuit.run(encrypted_example)
    result = circuit.decrypt(encrypted_result)
    print(f"Evaluation of {' + '.join(map(str, example))} homomorphically = {result}")

and the compiler would take care of everything for you, to do this addition in FHE.

Now, if your question is more of a cryptography question, I’ll be very succinct and encourage you to have a look to crypto papers (eg, Guide to Fully Homomorphic Encryption over the [Discretized] Torus, Section 4) for a deeper answer. Basically, an LWE cipher text is (a_0, a_1, …, a_n, b) where a_i are randoms and b is the body. m is recovered from b - \sum s_i a_i, where s_i is the bits of the secret key. If you add delta to b, ie compute a new cipher text (a_0, a_1, …, a_n, b + delta), you’ll see that it decrypts to m + decode(delta).

1 Like