-
I want to perform MPC between two parties to compute encryption over two blocks of messages. I want one party to supply the key as private input and the other party to supply the blocks. Is there an easy way to go about this? I checked the aes demo but I'm not super clear. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, you can use Line 119 in 50ab220 with: if mpc.pid == 1:
p = secfld.array(f256.array([[17 * (4*j + i) for j in range(4)] for i in range(4)]))
else:
p = secfld.array(None, (4, 4)) # dummy array value with shape (4,4)
p = mpc.input(p, 1) # private input from party 1 Similarly, replace the line: Line 122 in 50ab220 with: if mpc.pid == 2:
k128 = secfld.array(f256.array([[4*j + i for j in range(4)] for i in range(4)]))
else:
k128 = secfld.array(None, (4, 4)) # dummy array value with shape (4,4)
k128 = mpc.input(k128, 2) # private input from party 2 to let party 2 privately input a key Of course, you need to generate the value for the key input by party 2 randomly or so (e.g., read it from a local file), also see the OT demo for an example. And similarly for the plaintext. You can then run the program with three parties (because MPyC assumes an honest majority). Party 0 is the trusted helper as in the OT demo. |
Beta Was this translation helpful? Give feedback.
Yes, you can use
mpc.input()
to accomplish this, in much the same way as it's done in the Oblivious Transfer demo ot.py. If you start from the Numpy-based AES demo np_aes.py, you can for instance let party 1 privately input a plaintextp
by replacing the line:mpyc/demos/np_aes.py
Line 119 in 50ab220
with:
Similarly, replace the line:
m…