seal-python 4.1.2__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 HuGang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include seal.pyi
4
+ include py.typed
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: seal-python
3
+ Version: 4.1.2
4
+ Summary: Python wrapper for the Microsoft SEAL
5
+ Home-page: https://github.com/Huelse/SEAL-Python
6
+ Author: Huelse
7
+ Author-email: topmaxz@protonmail.com
8
+ License: MIT
9
+ Project-URL: Repository, https://github.com/Huelse/SEAL-Python
10
+ Project-URL: Issues, https://github.com/Huelse/SEAL-Python/issues
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: C++
23
+ Classifier: Topic :: Security :: Cryptography
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: license
34
+ Dynamic: license-file
35
+ Dynamic: project-url
36
+ Dynamic: requires-python
37
+ Dynamic: summary
38
+
39
+ ## Microsoft SEAL For Python
40
+
41
+ Microsoft [**SEAL**](https://github.com/microsoft/SEAL) is an easy-to-use open-source ([MIT licensed](https://github.com/microsoft/SEAL/blob/master/LICENSE)) homomorphic encryption library developed by the Cryptography Research group at Microsoft.
42
+
43
+ [**pybind11**](https://github.com/pybind/pybind11) is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.
44
+
45
+ This is a python binding for the Microsoft SEAL library.
46
+
47
+
48
+
49
+ ## Contents
50
+
51
+ * [Build](#build)
52
+ * [Typing](#typing)
53
+ * [Note](#note)
54
+ * [Serialize](#serialize)
55
+ * [Other](#other)
56
+ * [FAQ](#faq)
57
+ * [Release](#release)
58
+
59
+
60
+
61
+ ## Build
62
+
63
+ * ### Linux
64
+
65
+ Recommend: Clang++ (>= 10.0) or GNU G++ (>= 9.4), CMake (>= 3.16)
66
+
67
+ ```shell
68
+ # Optional
69
+ sudo apt-get install git build-essential cmake python3 python3-dev python3-pip
70
+
71
+ # Get the repository or download from the releases
72
+ git clone https://github.com/Huelse/SEAL-Python.git
73
+ cd SEAL-Python
74
+
75
+ # Install dependencies
76
+ pip3 install numpy pybind11
77
+
78
+ # Init the SEAL and pybind11
79
+ git submodule update --init --recursive
80
+ # Get the newest repositories (dev only)
81
+ # git submodule update --remote
82
+
83
+ # Build the SEAL lib without the msgsl zlib and zstandard compression
84
+ cd SEAL
85
+ cmake -S . -B build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_USE_ZSTD=OFF
86
+ cmake --build build
87
+ cd ..
88
+
89
+ # Run the setup.py, the dynamic library will be generated in the current directory
90
+ python3 setup.py build_ext -i
91
+
92
+ # Test
93
+ cp seal.*.so examples
94
+ cd examples
95
+ python3 4_bgv_basics.py
96
+ ```
97
+
98
+ Build examples: `-DSEAL_BUILD_EXAMPLES=ON`
99
+
100
+ [More cmake options](https://github.com/microsoft/SEAL#basic-cmake-options)
101
+
102
+
103
+ * ### Windows
104
+
105
+ Visual Studio 2019 or newer is required. x64 support only! And use the **x64 Native Tools Command Prompt for VS** command prompt to configure and build the Microsoft SEAL library. It's usually can be found in your Start Menu.
106
+
107
+ ```shell
108
+ # Run in "x64 Native Tools Command Prompt for VS" command prompt
109
+ cmake -S . -B build -G Ninja -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF
110
+ cmake --build build
111
+
112
+ # Build
113
+ pip install numpy pybind11
114
+ python setup.py build_ext -i
115
+
116
+ # Test
117
+ cp seal.*.pyd examples
118
+ cd examples
119
+ python 4_bgv_basics.py
120
+ ```
121
+
122
+ Microsoft SEAL official [docs](https://github.com/microsoft/SEAL#building-microsoft-seal-manually).
123
+
124
+
125
+ * ### Docker
126
+
127
+ requires: [Docker](https://www.docker.com/)
128
+
129
+ To build source code into a docker image (from this directory):
130
+ ```shell
131
+ docker build -t huelse/seal -f Dockerfile .
132
+ ```
133
+
134
+ To use the image by running it as an interactive container:
135
+ ```shell
136
+ docker run -it huelse/seal
137
+ ```
138
+
139
+
140
+
141
+ ## Note
142
+
143
+ * ### Serialize
144
+
145
+ See more in `examples/7_serialization.py`, here is a simple example:
146
+
147
+ ```python
148
+ cipher.save('cipher')
149
+ load_cipher = Ciphertext()
150
+ load_cipher.load(context, 'cipher') # work if the context is valid.
151
+ ```
152
+
153
+ Supported classes: `EncryptionParameters, Ciphertext, Plaintext, SecretKey, PublicKey, RelinKeys, GaloisKeys`
154
+
155
+
156
+ * ### Other
157
+
158
+ There are a lot of changes in the latest SEAL lib, we try to make the API in python can be used easier, but it may remain some problems unknown, if any problems or bugs, report [issues](https://github.com/Huelse/SEAL-Python/issues).
159
+
160
+ Email: [topmaxz@protonmail.com](mailto:topmaxz@protonmail.com?subject=Github-SEAL-Python-Issues)
161
+
162
+
163
+
164
+ ## FAQ
165
+
166
+ 1. ImportError: undefined symbol
167
+
168
+ Build a shared SEAL library `cmake . -DBUILD_SHARED_LIBS=ON`, and get the `libseal.so`,
169
+
170
+ then change the path in `setup.py`, and rebuild.
171
+
172
+
173
+ 2. ImportError: libseal.so... cannot find
174
+
175
+ a. `sudo ln -s /path/to/libseal.so /usr/lib`
176
+
177
+ b. add `/usr/local/lib` or the `SEAL/native/lib` to `/etc/ld.so.conf` and refresh it `sudo ldconfig`
178
+
179
+ c. build in cmake.
180
+
181
+
182
+ 3. BuildError:
183
+
184
+ 1. C++17 at least
185
+
186
+ 2. x86_64 is required, which `x86_32` is not supported
187
+
188
+
189
+ 4. ModuleNotFoundError: No module named 'seal'
190
+
191
+ The `.so` or `.pyd` file must be in the current directory, or you have `install` it already.
192
+
193
+
194
+ 5. Windows Error LNK2001, RuntimeLibrary and MT_StaticRelease mismatch
195
+
196
+ Only `x64` is supported, Choose `x64 Native Tools Command Prompt for VS`.
197
+
198
+
199
+ 6. Warning about building the dynamic library with static library in MacOS, etc.
200
+
201
+ 1. Build a shared SEAL library by adding a CMake option `-DBUILD_SHARED_LIBS=ON`
202
+
203
+ 2. Edit `extra_objects` in setup.py to `*.dylib` or else.
204
+
205
+
206
+ ## Typing
207
+
208
+ This project now ships `seal.pyi` and `py.typed` for Python type checking (PEP 561).
209
+
210
+ After build/install, editors such as Pylance/Pyright/mypy can use these hints for autocomplete and static analysis.
211
+
212
+
213
+ ## Release
214
+
215
+ Use `RELEASE.md` for the full PyPI release checklist.
216
+
217
+ Quick commands:
218
+
219
+ ```bash
220
+ python3 setup.py sdist bdist_wheel
221
+ python3 -m twine check dist/*
222
+ python3 -m twine upload dist/*
223
+ ```
224
+
225
+
226
+
227
+ ## Contributing
228
+
229
+ * Professor: [Dr. Chen](https://zhigang-chen.github.io/)
230
+
231
+ * [Contributors](https://github.com/Huelse/SEAL-Python/graphs/contributors)
@@ -0,0 +1,193 @@
1
+ ## Microsoft SEAL For Python
2
+
3
+ Microsoft [**SEAL**](https://github.com/microsoft/SEAL) is an easy-to-use open-source ([MIT licensed](https://github.com/microsoft/SEAL/blob/master/LICENSE)) homomorphic encryption library developed by the Cryptography Research group at Microsoft.
4
+
5
+ [**pybind11**](https://github.com/pybind/pybind11) is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code.
6
+
7
+ This is a python binding for the Microsoft SEAL library.
8
+
9
+
10
+
11
+ ## Contents
12
+
13
+ * [Build](#build)
14
+ * [Typing](#typing)
15
+ * [Note](#note)
16
+ * [Serialize](#serialize)
17
+ * [Other](#other)
18
+ * [FAQ](#faq)
19
+ * [Release](#release)
20
+
21
+
22
+
23
+ ## Build
24
+
25
+ * ### Linux
26
+
27
+ Recommend: Clang++ (>= 10.0) or GNU G++ (>= 9.4), CMake (>= 3.16)
28
+
29
+ ```shell
30
+ # Optional
31
+ sudo apt-get install git build-essential cmake python3 python3-dev python3-pip
32
+
33
+ # Get the repository or download from the releases
34
+ git clone https://github.com/Huelse/SEAL-Python.git
35
+ cd SEAL-Python
36
+
37
+ # Install dependencies
38
+ pip3 install numpy pybind11
39
+
40
+ # Init the SEAL and pybind11
41
+ git submodule update --init --recursive
42
+ # Get the newest repositories (dev only)
43
+ # git submodule update --remote
44
+
45
+ # Build the SEAL lib without the msgsl zlib and zstandard compression
46
+ cd SEAL
47
+ cmake -S . -B build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_USE_ZSTD=OFF
48
+ cmake --build build
49
+ cd ..
50
+
51
+ # Run the setup.py, the dynamic library will be generated in the current directory
52
+ python3 setup.py build_ext -i
53
+
54
+ # Test
55
+ cp seal.*.so examples
56
+ cd examples
57
+ python3 4_bgv_basics.py
58
+ ```
59
+
60
+ Build examples: `-DSEAL_BUILD_EXAMPLES=ON`
61
+
62
+ [More cmake options](https://github.com/microsoft/SEAL#basic-cmake-options)
63
+
64
+
65
+ * ### Windows
66
+
67
+ Visual Studio 2019 or newer is required. x64 support only! And use the **x64 Native Tools Command Prompt for VS** command prompt to configure and build the Microsoft SEAL library. It's usually can be found in your Start Menu.
68
+
69
+ ```shell
70
+ # Run in "x64 Native Tools Command Prompt for VS" command prompt
71
+ cmake -S . -B build -G Ninja -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF
72
+ cmake --build build
73
+
74
+ # Build
75
+ pip install numpy pybind11
76
+ python setup.py build_ext -i
77
+
78
+ # Test
79
+ cp seal.*.pyd examples
80
+ cd examples
81
+ python 4_bgv_basics.py
82
+ ```
83
+
84
+ Microsoft SEAL official [docs](https://github.com/microsoft/SEAL#building-microsoft-seal-manually).
85
+
86
+
87
+ * ### Docker
88
+
89
+ requires: [Docker](https://www.docker.com/)
90
+
91
+ To build source code into a docker image (from this directory):
92
+ ```shell
93
+ docker build -t huelse/seal -f Dockerfile .
94
+ ```
95
+
96
+ To use the image by running it as an interactive container:
97
+ ```shell
98
+ docker run -it huelse/seal
99
+ ```
100
+
101
+
102
+
103
+ ## Note
104
+
105
+ * ### Serialize
106
+
107
+ See more in `examples/7_serialization.py`, here is a simple example:
108
+
109
+ ```python
110
+ cipher.save('cipher')
111
+ load_cipher = Ciphertext()
112
+ load_cipher.load(context, 'cipher') # work if the context is valid.
113
+ ```
114
+
115
+ Supported classes: `EncryptionParameters, Ciphertext, Plaintext, SecretKey, PublicKey, RelinKeys, GaloisKeys`
116
+
117
+
118
+ * ### Other
119
+
120
+ There are a lot of changes in the latest SEAL lib, we try to make the API in python can be used easier, but it may remain some problems unknown, if any problems or bugs, report [issues](https://github.com/Huelse/SEAL-Python/issues).
121
+
122
+ Email: [topmaxz@protonmail.com](mailto:topmaxz@protonmail.com?subject=Github-SEAL-Python-Issues)
123
+
124
+
125
+
126
+ ## FAQ
127
+
128
+ 1. ImportError: undefined symbol
129
+
130
+ Build a shared SEAL library `cmake . -DBUILD_SHARED_LIBS=ON`, and get the `libseal.so`,
131
+
132
+ then change the path in `setup.py`, and rebuild.
133
+
134
+
135
+ 2. ImportError: libseal.so... cannot find
136
+
137
+ a. `sudo ln -s /path/to/libseal.so /usr/lib`
138
+
139
+ b. add `/usr/local/lib` or the `SEAL/native/lib` to `/etc/ld.so.conf` and refresh it `sudo ldconfig`
140
+
141
+ c. build in cmake.
142
+
143
+
144
+ 3. BuildError:
145
+
146
+ 1. C++17 at least
147
+
148
+ 2. x86_64 is required, which `x86_32` is not supported
149
+
150
+
151
+ 4. ModuleNotFoundError: No module named 'seal'
152
+
153
+ The `.so` or `.pyd` file must be in the current directory, or you have `install` it already.
154
+
155
+
156
+ 5. Windows Error LNK2001, RuntimeLibrary and MT_StaticRelease mismatch
157
+
158
+ Only `x64` is supported, Choose `x64 Native Tools Command Prompt for VS`.
159
+
160
+
161
+ 6. Warning about building the dynamic library with static library in MacOS, etc.
162
+
163
+ 1. Build a shared SEAL library by adding a CMake option `-DBUILD_SHARED_LIBS=ON`
164
+
165
+ 2. Edit `extra_objects` in setup.py to `*.dylib` or else.
166
+
167
+
168
+ ## Typing
169
+
170
+ This project now ships `seal.pyi` and `py.typed` for Python type checking (PEP 561).
171
+
172
+ After build/install, editors such as Pylance/Pyright/mypy can use these hints for autocomplete and static analysis.
173
+
174
+
175
+ ## Release
176
+
177
+ Use `RELEASE.md` for the full PyPI release checklist.
178
+
179
+ Quick commands:
180
+
181
+ ```bash
182
+ python3 setup.py sdist bdist_wheel
183
+ python3 -m twine check dist/*
184
+ python3 -m twine upload dist/*
185
+ ```
186
+
187
+
188
+
189
+ ## Contributing
190
+
191
+ * Professor: [Dr. Chen](https://zhigang-chen.github.io/)
192
+
193
+ * [Contributors](https://github.com/Huelse/SEAL-Python/graphs/contributors)
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,9 @@
1
+
2
+ [build-system]
3
+ requires = [
4
+ "setuptools>=42",
5
+ "wheel",
6
+ "pybind11>=2.9.1",
7
+ ]
8
+
9
+ build-backend = "setuptools.build_meta"