mpc-msri / EzPC

MIT License
401 stars 122 forks source link

Strange behavior with division on arithmetic sharing #189

Open zyl2016 opened 1 year ago

zyl2016 commented 1 year ago

Hello, sorry for disturbing you. I observed that division on arithmetic sharing cannot be conducted successfully. I use the division as follows.

def void main(){
    uint32_al a1 = 5u;
    uint32_al a2 = 5u;
    uint32_al a3 = a1 / a2;
    output(CLIENT, a3);
}

The result is shown below.

Value of a3:
2407609618

It seems to be a random number. In comparison, when I use division on boolean sharing in the same way. It outputs as expected.

def void main(){
    uint32_bl a1 = 5u;
    uint32_bl a2 = 5u;
    uint32_bl a3 = a1 / a2;
    output(CLIENT, a3);
}

The result is shown below.

Value of a3:
1

Can you help me by explaining this strange behavior? Did I use the division in the wrong way?