oblif
See documentation here!
Oblif is a library that lets you write data-oblivious code in a non-data-oblivious way. For example:
from mpyc.runtime import mpc
def test(x):
return 1 if x==5 else 0
mpc.run(mpc.start())
print("test(5) is", mpc.run(mpc.output(test(type(5)))))
mpc.run(mpc.shutdown())
2021-05-08 13:56:22,858 Start MPyC runtime v0.7.4
Traceback (most recent call last):
File "test-mpyc.py", line 14, in <module>
print("test(5) is", mpc.run(mpc.output(test(type(5)))))
File "test-mpyc.py", line 6, in test
return 1 if x==5 else 0
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mpyc-0.7.4-py3.8.egg/mpyc/sectypes.py", line 50, in __bool__
TypeError: cannot use secure type in Boolean expressions
But
from mpyc.runtime import mpc
from oblif.decorator import oblif
@oblif
def test(x):
return 1 if x==5 else 0
mpc.run(mpc.start())
type=mpc.SecInt()
type.ifelse = lambda self, ifval, elseval: ifval if ifval is elseval else mpc.if_else(self, ifval, elseval)
type.__deepcopy__ = lambda self, memo: self
print("test(5) is", mpc.run(mpc.output(test(type(5)))))
mpc.run(mpc.shutdown())
gives
2021-05-08 13:58:47,387 Start MPyC runtime v0.7.4
test(5) is 1
2021-05-08 13:58:47,394 Stop MPyC runtime -- elapsed time: 0:00:00.006167
Metadata
Release files for oblif 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oblif-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for oblif-0.3.1-py3-none-any.whl |
Release files / oblif-0.3.1-py3-none-any.whl
| Download URL | oblif-0.3.1-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4386cb8b395873801bc63657b59785e30977e98d08849d737ba55c781e836af6
|
|
BLAKE2b-256 checksum How to use checksums |
ab8b60efe18580864d8da2c65ab5fd2df4fa5927793695418a24ca835a019f35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 CPython/3.10.4
|
Security for oblif 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.