oblivlib 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oblivlib/__init__.py +127 -0
- oblivlib/dependency/__init__.py +96 -0
- oblivlib/dependency/avl_tree.py +14 -0
- oblivlib/dependency/balls_into_bins.py +25 -0
- oblivlib/dependency/bplus_tree.py +20 -0
- oblivlib/dependency/client.py +442 -0
- oblivlib/dependency/config.py +386 -0
- oblivlib/dependency/contract.py +87 -0
- oblivlib/dependency/crypto.py +101 -0
- oblivlib/dependency/errors.py +46 -0
- oblivlib/dependency/heap_index.py +62 -0
- oblivlib/dependency/keyed_store.py +49 -0
- oblivlib/dependency/layout.py +328 -0
- oblivlib/dependency/metrics.py +119 -0
- oblivlib/dependency/path_cipher.py +124 -0
- oblivlib/dependency/protocol.py +151 -0
- oblivlib/dependency/server_stores.py +161 -0
- oblivlib/dependency/storage_server.py +214 -0
- oblivlib/dependency/transport.py +144 -0
- oblivlib/dependency/tree_builder.py +138 -0
- oblivlib/dependency/tree_storage_base.py +186 -0
- oblivlib/dependency/types.py +41 -0
- oblivlib/graph/__init__.py +4 -0
- oblivlib/graph/graphos.py +388 -0
- oblivlib/graph/grove.py +577 -0
- oblivlib/graph/meta.py +73 -0
- oblivlib/omap/__init__.py +6 -0
- oblivlib/omap/avl_omap.py +492 -0
- oblivlib/omap/base_omap.py +21 -0
- oblivlib/omap/bplus_omap.py +430 -0
- oblivlib/omap/group_omap.py +194 -0
- oblivlib/omap/oram_ost_omap.py +96 -0
- oblivlib/omap/ost_base_omap.py +334 -0
- oblivlib/oram/__init__.py +15 -0
- oblivlib/oram/counter_oram.py +132 -0
- oblivlib/oram/da_oram.py +96 -0
- oblivlib/oram/freecursive_oram.py +153 -0
- oblivlib/oram/mul_path_oram.py +28 -0
- oblivlib/oram/path_oram.py +23 -0
- oblivlib/oram/recursive_path_oram.py +129 -0
- oblivlib/oram/static_oram.py +24 -0
- oblivlib/oram/tree_base_oram.py +156 -0
- oblivlib/py.typed +0 -0
- oblivlib-0.1.0.dist-info/METADATA +139 -0
- oblivlib-0.1.0.dist-info/RECORD +48 -0
- oblivlib-0.1.0.dist-info/WHEEL +5 -0
- oblivlib-0.1.0.dist-info/licenses/LICENSE +191 -0
- oblivlib-0.1.0.dist-info/top_level.txt +1 -0
oblivlib/__init__.py
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
from oblivlib.dependency import (
|
|
2
|
+
AccessBudget,
|
|
3
|
+
AesGcm,
|
|
4
|
+
AvlOmapConfig,
|
|
5
|
+
Backend,
|
|
6
|
+
BPlusOmapConfig,
|
|
7
|
+
CapacityError,
|
|
8
|
+
Client,
|
|
9
|
+
ContractError,
|
|
10
|
+
CounterOramConfig,
|
|
11
|
+
DaOramConfig,
|
|
12
|
+
DuplicateLabelError,
|
|
13
|
+
Encryptor,
|
|
14
|
+
FreecursiveOramConfig,
|
|
15
|
+
GraphConfig,
|
|
16
|
+
GraphOsConfig,
|
|
17
|
+
GroupOmapConfig,
|
|
18
|
+
GroveConfig,
|
|
19
|
+
InitData,
|
|
20
|
+
LocalBackend,
|
|
21
|
+
LoopbackTransport,
|
|
22
|
+
Measurement,
|
|
23
|
+
Metrics,
|
|
24
|
+
MissingResultError,
|
|
25
|
+
MulPathOramConfig,
|
|
26
|
+
OblivlibError,
|
|
27
|
+
OmapConfig,
|
|
28
|
+
OramConfig,
|
|
29
|
+
PathOramConfig,
|
|
30
|
+
PosMapOramConfig,
|
|
31
|
+
ProtocolError,
|
|
32
|
+
RecursiveOramConfig,
|
|
33
|
+
RowSizeError,
|
|
34
|
+
ServerError,
|
|
35
|
+
SimulatedNetwork,
|
|
36
|
+
StashOverflowError,
|
|
37
|
+
StaticOramConfig,
|
|
38
|
+
StorageError,
|
|
39
|
+
StorageServer,
|
|
40
|
+
Transport,
|
|
41
|
+
TransportBackend,
|
|
42
|
+
TransportError,
|
|
43
|
+
TreeOmapConfig,
|
|
44
|
+
UnknownLabelError,
|
|
45
|
+
ZmqListener,
|
|
46
|
+
ZmqTransport,
|
|
47
|
+
serve,
|
|
48
|
+
)
|
|
49
|
+
from oblivlib.graph import (
|
|
50
|
+
GraphOS,
|
|
51
|
+
Grove,
|
|
52
|
+
)
|
|
53
|
+
from oblivlib.omap import (
|
|
54
|
+
AVLOmap,
|
|
55
|
+
BPlusOmap,
|
|
56
|
+
GroupOmap,
|
|
57
|
+
OramOstOmap,
|
|
58
|
+
)
|
|
59
|
+
from oblivlib.oram import (
|
|
60
|
+
DAOram,
|
|
61
|
+
FreecursiveOram,
|
|
62
|
+
MulPathOram,
|
|
63
|
+
PathOram,
|
|
64
|
+
RecursivePathOram,
|
|
65
|
+
StaticOram,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
__all__ = [
|
|
69
|
+
"AVLOmap",
|
|
70
|
+
"AccessBudget",
|
|
71
|
+
"AesGcm",
|
|
72
|
+
"AvlOmapConfig",
|
|
73
|
+
"BPlusOmap",
|
|
74
|
+
"BPlusOmapConfig",
|
|
75
|
+
"Backend",
|
|
76
|
+
"CapacityError",
|
|
77
|
+
"Client",
|
|
78
|
+
"ContractError",
|
|
79
|
+
"CounterOramConfig",
|
|
80
|
+
"DAOram",
|
|
81
|
+
"DaOramConfig",
|
|
82
|
+
"DuplicateLabelError",
|
|
83
|
+
"Encryptor",
|
|
84
|
+
"FreecursiveOram",
|
|
85
|
+
"FreecursiveOramConfig",
|
|
86
|
+
"GraphConfig",
|
|
87
|
+
"GraphOS",
|
|
88
|
+
"GraphOsConfig",
|
|
89
|
+
"GroupOmap",
|
|
90
|
+
"GroupOmapConfig",
|
|
91
|
+
"Grove",
|
|
92
|
+
"GroveConfig",
|
|
93
|
+
"InitData",
|
|
94
|
+
"LocalBackend",
|
|
95
|
+
"LoopbackTransport",
|
|
96
|
+
"Measurement",
|
|
97
|
+
"Metrics",
|
|
98
|
+
"MissingResultError",
|
|
99
|
+
"MulPathOram",
|
|
100
|
+
"MulPathOramConfig",
|
|
101
|
+
"OblivlibError",
|
|
102
|
+
"OmapConfig",
|
|
103
|
+
"OramConfig",
|
|
104
|
+
"OramOstOmap",
|
|
105
|
+
"PathOram",
|
|
106
|
+
"PathOramConfig",
|
|
107
|
+
"PosMapOramConfig",
|
|
108
|
+
"ProtocolError",
|
|
109
|
+
"RecursiveOramConfig",
|
|
110
|
+
"RecursivePathOram",
|
|
111
|
+
"RowSizeError",
|
|
112
|
+
"ServerError",
|
|
113
|
+
"SimulatedNetwork",
|
|
114
|
+
"StashOverflowError",
|
|
115
|
+
"StaticOram",
|
|
116
|
+
"StaticOramConfig",
|
|
117
|
+
"StorageError",
|
|
118
|
+
"StorageServer",
|
|
119
|
+
"Transport",
|
|
120
|
+
"TransportBackend",
|
|
121
|
+
"TransportError",
|
|
122
|
+
"TreeOmapConfig",
|
|
123
|
+
"UnknownLabelError",
|
|
124
|
+
"ZmqListener",
|
|
125
|
+
"ZmqTransport",
|
|
126
|
+
"serve",
|
|
127
|
+
]
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Public API for ``oblivlib.dependency``.
|
|
2
|
+
|
|
3
|
+
Names are re-exported explicitly (rather than via ``from .mod import *``) so the
|
|
4
|
+
public surface is type-checker-visible, free of incidental stdlib/typing leakage,
|
|
5
|
+
and stated in one place — ``__all__``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .client import Backend, Client, LocalBackend, TransportBackend
|
|
9
|
+
from .config import (
|
|
10
|
+
AccessBudget,
|
|
11
|
+
AvlOmapConfig,
|
|
12
|
+
BPlusOmapConfig,
|
|
13
|
+
CounterOramConfig,
|
|
14
|
+
DaOramConfig,
|
|
15
|
+
FreecursiveOramConfig,
|
|
16
|
+
GraphConfig,
|
|
17
|
+
GraphOsConfig,
|
|
18
|
+
GroupOmapConfig,
|
|
19
|
+
GroveConfig,
|
|
20
|
+
MulPathOramConfig,
|
|
21
|
+
OmapConfig,
|
|
22
|
+
OramConfig,
|
|
23
|
+
PathOramConfig,
|
|
24
|
+
PosMapOramConfig,
|
|
25
|
+
RecursiveOramConfig,
|
|
26
|
+
StaticOramConfig,
|
|
27
|
+
TreeOmapConfig,
|
|
28
|
+
)
|
|
29
|
+
from .crypto import AesGcm, Encryptor
|
|
30
|
+
from .errors import (
|
|
31
|
+
CapacityError,
|
|
32
|
+
ContractError,
|
|
33
|
+
DuplicateLabelError,
|
|
34
|
+
MissingResultError,
|
|
35
|
+
OblivlibError,
|
|
36
|
+
ProtocolError,
|
|
37
|
+
RowSizeError,
|
|
38
|
+
ServerError,
|
|
39
|
+
StashOverflowError,
|
|
40
|
+
StorageError,
|
|
41
|
+
TransportError,
|
|
42
|
+
UnknownLabelError,
|
|
43
|
+
)
|
|
44
|
+
from .metrics import Measurement, Metrics
|
|
45
|
+
from .storage_server import StorageServer
|
|
46
|
+
from .transport import LoopbackTransport, SimulatedNetwork, Transport, ZmqListener, ZmqTransport, serve
|
|
47
|
+
from .types import InitData
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"AccessBudget",
|
|
51
|
+
"Backend",
|
|
52
|
+
"Client",
|
|
53
|
+
"LocalBackend",
|
|
54
|
+
"TransportBackend",
|
|
55
|
+
"AesGcm",
|
|
56
|
+
"Encryptor",
|
|
57
|
+
"CapacityError",
|
|
58
|
+
"ContractError",
|
|
59
|
+
"DuplicateLabelError",
|
|
60
|
+
"MissingResultError",
|
|
61
|
+
"OblivlibError",
|
|
62
|
+
"ProtocolError",
|
|
63
|
+
"RowSizeError",
|
|
64
|
+
"ServerError",
|
|
65
|
+
"StashOverflowError",
|
|
66
|
+
"StorageError",
|
|
67
|
+
"TransportError",
|
|
68
|
+
"UnknownLabelError",
|
|
69
|
+
"Measurement",
|
|
70
|
+
"Metrics",
|
|
71
|
+
"StorageServer",
|
|
72
|
+
"LoopbackTransport",
|
|
73
|
+
"SimulatedNetwork",
|
|
74
|
+
"Transport",
|
|
75
|
+
"ZmqListener",
|
|
76
|
+
"ZmqTransport",
|
|
77
|
+
"serve",
|
|
78
|
+
"InitData",
|
|
79
|
+
"AvlOmapConfig",
|
|
80
|
+
"BPlusOmapConfig",
|
|
81
|
+
"CounterOramConfig",
|
|
82
|
+
"DaOramConfig",
|
|
83
|
+
"FreecursiveOramConfig",
|
|
84
|
+
"GraphConfig",
|
|
85
|
+
"GraphOsConfig",
|
|
86
|
+
"GroupOmapConfig",
|
|
87
|
+
"GroveConfig",
|
|
88
|
+
"MulPathOramConfig",
|
|
89
|
+
"OmapConfig",
|
|
90
|
+
"OramConfig",
|
|
91
|
+
"PathOramConfig",
|
|
92
|
+
"PosMapOramConfig",
|
|
93
|
+
"RecursiveOramConfig",
|
|
94
|
+
"StaticOramConfig",
|
|
95
|
+
"TreeOmapConfig",
|
|
96
|
+
]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class AVLNode:
|
|
6
|
+
key: bytes
|
|
7
|
+
leaf: int
|
|
8
|
+
value: bytes
|
|
9
|
+
r_key: bytes | None = None
|
|
10
|
+
r_leaf: int | None = None
|
|
11
|
+
r_height: int = 0
|
|
12
|
+
l_key: bytes | None = None
|
|
13
|
+
l_leaf: int | None = None
|
|
14
|
+
l_height: int = 0
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import math
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def max_bin_load(num_bins: int, security_bits: int = 128) -> int:
|
|
5
|
+
x = (math.log2(num_bins) + security_bits - 1) / math.e
|
|
6
|
+
return math.ceil(math.exp(lambert_w(x) + 1))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def lambert_w(x: float, tol: float = 1e-10, max_iter: int = 100) -> float:
|
|
10
|
+
if x < -math.exp(-1):
|
|
11
|
+
raise ValueError("lambert_w(x) is not defined for x < -1/e.")
|
|
12
|
+
|
|
13
|
+
w = 0 if x <= 1 else math.log(x) - math.log(math.log(x))
|
|
14
|
+
|
|
15
|
+
for _ in range(max_iter):
|
|
16
|
+
ew = math.exp(w)
|
|
17
|
+
wew = w * ew
|
|
18
|
+
w_next = w - (wew - x) / (ew * (w + 1) - (w + 2) * (wew - x) / (2 * w + 2))
|
|
19
|
+
|
|
20
|
+
if abs(w_next - w) < tol:
|
|
21
|
+
return w_next
|
|
22
|
+
|
|
23
|
+
w = w_next
|
|
24
|
+
|
|
25
|
+
raise RuntimeError("Lambert W function did not converge")
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class BPlusLeaf:
|
|
6
|
+
key: int
|
|
7
|
+
leaf: int
|
|
8
|
+
keys: list[bytes]
|
|
9
|
+
values: list[bytes]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class BPlusInternal:
|
|
14
|
+
key: int
|
|
15
|
+
leaf: int
|
|
16
|
+
keys: list[bytes]
|
|
17
|
+
children: list[tuple[int, int]]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
BPlusNode = BPlusLeaf | BPlusInternal
|