Coder Social home page Coder Social logo

nthparty / oblivious Goto Github PK

View Code? Open in Web Editor NEW
26.0 3.0 5.0 3.22 MB

Python library that serves as an API for common cryptographic primitives used to implement OPRF, OT, and PSI protocols.

Home Page: https://pypi.org/project/oblivious

License: MIT License

Python 100.00%
oprf oblivious-transfer cryptography cryptographic-library python-cryptography mpc multi-party multi-party-computation secure-multi-party-computation secure-multiparty-computation

oblivious's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

oblivious's Issues

Unable to compute inverse of a scalar while using the Oblivious.ristretto library

When I try to find an inverse of a scalar, it doesn't work as expected while using the Oblivious.ristretto library.

I tried couple of variations to test out the discrepancy in the behavior.

Here are few of those instances:

#Some scalar s
s = scalar.hash("s".encode())

The scalars for which I am able to get an inverse:
~(s)
~(s * s)

But, if the scalar is of the form (s + s'), I am not able to get the inverse of it.
It throws - TypeError: bad operand type for unary ~: 'bytes'. I also tried using the inverse() method but that failed to work too.

Surprisingly, this error seems to be localised only within the Oblivious.ristretto library. The Oblivious.bn254 works well and behaves as expected.

We tested out these instances on google colab. Adding python code here for reference.

from oblivious.ristretto import point, scalar

s = scalar.hash(b"123")
m =  scalar.hash(b"456")

#Works
~(s)
~(s*s)

#Doesn't work
~(s+s)
~(s+m)

Do let me know if you need more context.

How to use this library to implement oblivious transfer?

Hi. I am looking for a library to implement the oblivious transfer.
The readme file says this library can be used to do so. But I do not know how to do it.
Is that possible to add some example code in the readme file or add an example folder with scripts implementing the OPRF, OT, and PSI?

Document the purpose of `point.canonical()`

Document the purpose of point.canonical(), performance benefit, equality of the bytes returned by point.to_bytes().

We just need to be clear that the bytes spit out (when you type a point variable into the interpreter, or print .to_bytes()) for p1 and p2 where p1 == p2 are not always the same.

Then, we can have .to_bytes(canonicalize=True) be the default and clarify that .to_bytes(canonicalize=False) is faster if you aren't doing byte-to-byte comparisons or other derivations directly from the bytes spit out.

Users of this library need to know that assert (p1.to_bytes() == p2.to_bytes()) == (p1 == p2) will sometimes fail, depending on how the points were computed (due to algorithms for computing point operations using optimizations such as using Jacobi coordinates x,y,z to represent points vs affine coordinates x,y and so on).

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.