GithubHelp home page GithubHelp logo

Comments (4)

Oleksandr-Tkachenko avatar Oleksandr-Tkachenko commented on August 18, 2024 1

Thanks for pointing this out. The way you are using ABY is correct. The problem was a bug in this function. It should work fine now. Please try out the new version and if you will face any problems, just let me know.

from aby.

Oleksandr-Tkachenko avatar Oleksandr-Tkachenko commented on August 18, 2024

Hi,

the Barrel Shifter gate works indeed as expected. Since ABY internally uses big-endian representation (C/C++ uses little-endian), PutRightBarrelShifter(<110>, <1>) = 110 << 1 = 0x6E << 1 = 220 = 0xDC. Furthermore, shifting the value 110 you would get neither 11 nor 1100 because these are decimal numbers and values are shifted bit-wise. For this purpose, I would suggest using the more intuitive hexadecimal representation, i.e., 0x6E for the decimal 110 and 0x06 for the binary 110. Another possibility is also to use the binary representation in C++17 as 0b0000'0110 which, however, has to
be first enabled in the compiler.

P.S.: to prevent confusion because of the changing endianness, I will switch left and right shift functions, so the shifting logic will be the same as in C.

Best,
Alex

from aby.

akappy7 avatar akappy7 commented on August 18, 2024

Thank you for the response. Closing the issue.

from aby.

akappy7 avatar akappy7 commented on August 18, 2024

I believe line 3144 of src/abycore/circuit/booleancircuits.cpp should be:

vector<uint32_t> res = PutBarrelLeftShifterGate(wires, n);

instead of:

vector<uint32_t> res = PutBarrelRightShifterGate(wires, n);

Also, would it be possible to give an example of a PutBarrelRightShifterGate with the new implementation? (Maybe using the same values of 110 and 1). I expect 55 to be the result but that is not the result I am seeing. I am getting "3959422976".

from aby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.