vfhe 0.0.0__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.

Potentially problematic release.


This version of vfhe might be problematic. Click here for more details.

Files changed (167) hide show
  1. vfhe-0.0.0/.clang-format +8 -0
  2. vfhe-0.0.0/.editorconfig +22 -0
  3. vfhe-0.0.0/.generated/_vfhe_proto/__init__.py +1 -0
  4. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/__init__.py +1 -0
  5. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/circuit/__init__.py +1 -0
  6. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/circuit/gkr/__init__.py +1 -0
  7. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/circuit/gkr/v1/__init__.py +1 -0
  8. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/circuit/gkr/v1/gkr_pb2.py +42 -0
  9. vfhe-0.0.0/.generated/_vfhe_proto/vfhe/circuit/gkr/v1/gkr_pb2.pyi +43 -0
  10. vfhe-0.0.0/.gitignore +21 -0
  11. vfhe-0.0.0/.gitmessage +11 -0
  12. vfhe-0.0.0/.gitmodules +6 -0
  13. vfhe-0.0.0/LICENSE +201 -0
  14. vfhe-0.0.0/MANIFEST.in +23 -0
  15. vfhe-0.0.0/Makefile +34 -0
  16. vfhe-0.0.0/NOTICE +46 -0
  17. vfhe-0.0.0/PKG-INFO +256 -0
  18. vfhe-0.0.0/README.md +227 -0
  19. vfhe-0.0.0/external/blake3/LICENSE_A2 +202 -0
  20. vfhe-0.0.0/external/blake3/LICENSE_A2LLVM +219 -0
  21. vfhe-0.0.0/external/blake3/LICENSE_CC0 +121 -0
  22. vfhe-0.0.0/external/blake3/c/blake3.c +651 -0
  23. vfhe-0.0.0/external/blake3/c/blake3.h +86 -0
  24. vfhe-0.0.0/external/blake3/c/blake3_avx2.c +326 -0
  25. vfhe-0.0.0/external/blake3/c/blake3_avx2_x86-64_unix.S +1815 -0
  26. vfhe-0.0.0/external/blake3/c/blake3_avx2_x86-64_windows_gnu.S +1817 -0
  27. vfhe-0.0.0/external/blake3/c/blake3_avx512.c +1388 -0
  28. vfhe-0.0.0/external/blake3/c/blake3_avx512_x86-64_unix.S +4824 -0
  29. vfhe-0.0.0/external/blake3/c/blake3_avx512_x86-64_windows_gnu.S +2615 -0
  30. vfhe-0.0.0/external/blake3/c/blake3_dispatch.c +332 -0
  31. vfhe-0.0.0/external/blake3/c/blake3_impl.h +333 -0
  32. vfhe-0.0.0/external/blake3/c/blake3_neon.c +367 -0
  33. vfhe-0.0.0/external/blake3/c/blake3_portable.c +160 -0
  34. vfhe-0.0.0/external/blake3/c/blake3_sse2.c +566 -0
  35. vfhe-0.0.0/external/blake3/c/blake3_sse2_x86-64_unix.S +2291 -0
  36. vfhe-0.0.0/external/blake3/c/blake3_sse2_x86-64_windows_gnu.S +2332 -0
  37. vfhe-0.0.0/external/blake3/c/blake3_sse41.c +560 -0
  38. vfhe-0.0.0/external/blake3/c/blake3_sse41_x86-64_unix.S +2028 -0
  39. vfhe-0.0.0/external/blake3/c/blake3_sse41_x86-64_windows_gnu.S +2069 -0
  40. vfhe-0.0.0/external/blake3/c/example.c +36 -0
  41. vfhe-0.0.0/external/blake3/c/example_tbb.c +57 -0
  42. vfhe-0.0.0/external/blake3/c/main.c +166 -0
  43. vfhe-0.0.0/modules/arith/README.md +92 -0
  44. vfhe-0.0.0/modules/arith/c/fuzz/fuzz_poly.c +106 -0
  45. vfhe-0.0.0/modules/arith/c/include/arith/cfft.h +102 -0
  46. vfhe-0.0.0/modules/arith/c/include/arith/config.h +29 -0
  47. vfhe-0.0.0/modules/arith/c/include/arith/error.h +33 -0
  48. vfhe-0.0.0/modules/arith/c/include/arith/mp.h +218 -0
  49. vfhe-0.0.0/modules/arith/c/include/arith/nt.h +77 -0
  50. vfhe-0.0.0/modules/arith/c/include/arith/ntt.h +94 -0
  51. vfhe-0.0.0/modules/arith/c/include/arith/poly.h +353 -0
  52. vfhe-0.0.0/modules/arith/c/include/arith/ring.h +135 -0
  53. vfhe-0.0.0/modules/arith/c/include/arith/tower.h +162 -0
  54. vfhe-0.0.0/modules/arith/c/include/arith/zq.h +243 -0
  55. vfhe-0.0.0/modules/arith/c/include/arith/zqvec.h +59 -0
  56. vfhe-0.0.0/modules/arith/c/include/arith.h +37 -0
  57. vfhe-0.0.0/modules/arith/c/src/encode/cfft.c +459 -0
  58. vfhe-0.0.0/modules/arith/c/src/encode/cfft_batch.c +74 -0
  59. vfhe-0.0.0/modules/arith/c/src/mp/mp_bridge.c +70 -0
  60. vfhe-0.0.0/modules/arith/c/src/mp/mp_internal.h +35 -0
  61. vfhe-0.0.0/modules/arith/c/src/mp/mp_poly.c +497 -0
  62. vfhe-0.0.0/modules/arith/c/src/mp/mp_scalar.c +192 -0
  63. vfhe-0.0.0/modules/arith/c/src/nt/nt.c +114 -0
  64. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_avx512_32.c +83 -0
  65. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_avx512_50.c +88 -0
  66. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_avx512_64.c +121 -0
  67. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_avx512_driver.inc +363 -0
  68. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_avx512_tables.c +244 -0
  69. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_backends.h +60 -0
  70. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_plan.c +57 -0
  71. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_portable.c +128 -0
  72. vfhe-0.0.0/modules/arith/c/src/ntt/ntt_tables.c +59 -0
  73. vfhe-0.0.0/modules/arith/c/src/poly/int_poly.c +69 -0
  74. vfhe-0.0.0/modules/arith/c/src/poly/poly_arith.c +274 -0
  75. vfhe-0.0.0/modules/arith/c/src/poly/poly_convert.c +116 -0
  76. vfhe-0.0.0/modules/arith/c/src/poly/poly_core.c +127 -0
  77. vfhe-0.0.0/modules/arith/c/src/poly/poly_digest.c +34 -0
  78. vfhe-0.0.0/modules/arith/c/src/poly/poly_gadget.c +44 -0
  79. vfhe-0.0.0/modules/arith/c/src/poly/poly_galois.c +204 -0
  80. vfhe-0.0.0/modules/arith/c/src/poly/poly_mul.c +89 -0
  81. vfhe-0.0.0/modules/arith/c/src/poly/poly_sample.c +77 -0
  82. vfhe-0.0.0/modules/arith/c/src/poly/poly_slots.c +101 -0
  83. vfhe-0.0.0/modules/arith/c/src/ring/ring.c +102 -0
  84. vfhe-0.0.0/modules/arith/c/src/ring/ring_internal.h +19 -0
  85. vfhe-0.0.0/modules/arith/c/src/ring/ring_mul.c +88 -0
  86. vfhe-0.0.0/modules/arith/c/src/tower/baseconv.c +187 -0
  87. vfhe-0.0.0/modules/arith/c/src/tower/lift.c +79 -0
  88. vfhe-0.0.0/modules/arith/c/src/tower/limbset.c +52 -0
  89. vfhe-0.0.0/modules/arith/c/src/tower/rescale.c +151 -0
  90. vfhe-0.0.0/modules/arith/c/src/vec/zq_vec.c +65 -0
  91. vfhe-0.0.0/modules/arith/c/src/zq/zq.c +129 -0
  92. vfhe-0.0.0/modules/arith/c/src/zq/zq_avx512_32.c +311 -0
  93. vfhe-0.0.0/modules/arith/c/src/zq/zq_avx512_50.c +363 -0
  94. vfhe-0.0.0/modules/arith/c/src/zq/zq_avx512_64.c +374 -0
  95. vfhe-0.0.0/modules/arith/c/src/zq/zq_backends.h +28 -0
  96. vfhe-0.0.0/modules/arith/c/src/zq/zq_portable.c +134 -0
  97. vfhe-0.0.0/modules/arith/c/test/test_arith_support.h +51 -0
  98. vfhe-0.0.0/modules/arith/c/test/test_mp.c +141 -0
  99. vfhe-0.0.0/modules/arith/c/test/test_nt.c +40 -0
  100. vfhe-0.0.0/modules/arith/c/test/test_ntt.c +100 -0
  101. vfhe-0.0.0/modules/arith/c/test/test_poly.c +465 -0
  102. vfhe-0.0.0/modules/arith/c/test/test_tower.c +110 -0
  103. vfhe-0.0.0/modules/arith/c/test/test_vec.c +91 -0
  104. vfhe-0.0.0/modules/arith/c/test/test_zq.c +177 -0
  105. vfhe-0.0.0/modules/arith/python/cdef/arith.cdef +108 -0
  106. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/__init__.py +45 -0
  107. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/encoding.py +170 -0
  108. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/errors.py +52 -0
  109. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/multiprecision.py +97 -0
  110. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/number_theory.py +88 -0
  111. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/polynomial.py +508 -0
  112. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/registry.py +98 -0
  113. vfhe-0.0.0/modules/arith/python/src/vfhe/arith/ring.py +274 -0
  114. vfhe-0.0.0/modules/base/README.md +15 -0
  115. vfhe-0.0.0/modules/base/c/include/base.h +175 -0
  116. vfhe-0.0.0/modules/base/c/src/alloc.c +32 -0
  117. vfhe-0.0.0/modules/base/c/src/bits.c +53 -0
  118. vfhe-0.0.0/modules/base/c/src/cpu.c +54 -0
  119. vfhe-0.0.0/modules/base/c/src/debug.c +19 -0
  120. vfhe-0.0.0/modules/base/c/src/modswitch.c +66 -0
  121. vfhe-0.0.0/modules/base/c/test/test_base.c +206 -0
  122. vfhe-0.0.0/modules/circuit/README.md +19 -0
  123. vfhe-0.0.0/modules/circuit/proto/buf.yaml +10 -0
  124. vfhe-0.0.0/modules/circuit/proto/vfhe/circuit/gkr/v1/gkr.proto +28 -0
  125. vfhe-0.0.0/modules/circuit/python/src/vfhe/circuit/__init__.py +15 -0
  126. vfhe-0.0.0/modules/circuit/python/src/vfhe/circuit/builder.py +26 -0
  127. vfhe-0.0.0/modules/circuit/python/src/vfhe/circuit/export.py +245 -0
  128. vfhe-0.0.0/modules/compiler/.gitkeep +0 -0
  129. vfhe-0.0.0/modules/compiler/README.md +6 -0
  130. vfhe-0.0.0/modules/conftest.py +15 -0
  131. vfhe-0.0.0/modules/fhe/.gitkeep +0 -0
  132. vfhe-0.0.0/modules/fhe/README.md +3 -0
  133. vfhe-0.0.0/modules/mlwe/.gitkeep +0 -0
  134. vfhe-0.0.0/modules/mlwe/README.md +3 -0
  135. vfhe-0.0.0/modules/piop/.gitkeep +0 -0
  136. vfhe-0.0.0/modules/piop/README.md +3 -0
  137. vfhe-0.0.0/modules/polycom/.gitkeep +0 -0
  138. vfhe-0.0.0/modules/polycom/README.md +3 -0
  139. vfhe-0.0.0/modules/rng/README.md +13 -0
  140. vfhe-0.0.0/modules/rng/c/include/rng.h +71 -0
  141. vfhe-0.0.0/modules/rng/c/src/aes_ctr.c +207 -0
  142. vfhe-0.0.0/modules/rng/c/src/rng_internal.h +42 -0
  143. vfhe-0.0.0/modules/rng/c/src/sampling.c +68 -0
  144. vfhe-0.0.0/modules/rng/c/src/seed.c +70 -0
  145. vfhe-0.0.0/modules/rng/c/src/stream.c +68 -0
  146. vfhe-0.0.0/modules/rng/c/test/test_rng.c +147 -0
  147. vfhe-0.0.0/modules/snark/.gitkeep +0 -0
  148. vfhe-0.0.0/modules/snark/README.md +3 -0
  149. vfhe-0.0.0/modules/vfhe/.gitkeep +0 -0
  150. vfhe-0.0.0/modules/vfhe/README.md +3 -0
  151. vfhe-0.0.0/native/build_ffi.py +150 -0
  152. vfhe-0.0.0/native/discovery.py +92 -0
  153. vfhe-0.0.0/pyproject.toml +91 -0
  154. vfhe-0.0.0/pyrightconfig.json +27 -0
  155. vfhe-0.0.0/scripts/build_fuzzers.py +107 -0
  156. vfhe-0.0.0/scripts/check_simd_build.py +80 -0
  157. vfhe-0.0.0/scripts/gen_proto.py +70 -0
  158. vfhe-0.0.0/scripts/run_c_tests.py +127 -0
  159. vfhe-0.0.0/scripts/smoke_import.py +15 -0
  160. vfhe-0.0.0/setup.cfg +4 -0
  161. vfhe-0.0.0/setup.py +48 -0
  162. vfhe-0.0.0/stubs/_vfhe_native.pyi +5 -0
  163. vfhe-0.0.0/vfhe.egg-info/PKG-INFO +256 -0
  164. vfhe-0.0.0/vfhe.egg-info/SOURCES.txt +165 -0
  165. vfhe-0.0.0/vfhe.egg-info/dependency_links.txt +1 -0
  166. vfhe-0.0.0/vfhe.egg-info/requires.txt +3 -0
  167. vfhe-0.0.0/vfhe.egg-info/top_level.txt +3 -0
@@ -0,0 +1,8 @@
1
+ BasedOnStyle: LLVM
2
+ IndentWidth: 4
3
+ TabWidth: 4
4
+ UseTab: Never
5
+ BreakBeforeBraces: Allman
6
+ ColumnLimit: 100
7
+ AlignTrailingComments: true
8
+ SortIncludes: false
@@ -0,0 +1,22 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+
9
+ [*.{c,h}]
10
+ indent_style = space
11
+ indent_size = 4
12
+
13
+ [*.py]
14
+ indent_style = space
15
+ indent_size = 4
16
+
17
+ [*.{yml,yaml,toml,json}]
18
+ indent_style = space
19
+ indent_size = 2
20
+
21
+ [Makefile]
22
+ indent_style = tab
@@ -0,0 +1 @@
1
+ """Generated protobuf bindings - do not edit, do not commit."""
@@ -0,0 +1 @@
1
+ """Generated protobuf bindings - do not edit, do not commit."""
@@ -0,0 +1 @@
1
+ """Generated protobuf bindings - do not edit, do not commit."""
@@ -0,0 +1 @@
1
+ """Generated protobuf bindings - do not edit, do not commit."""
@@ -0,0 +1 @@
1
+ """Generated protobuf bindings - do not edit, do not commit."""
@@ -0,0 +1,42 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: vfhe/circuit/gkr/v1/gkr.proto
5
+ # Protobuf Python Version: 6.33.5
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 33,
16
+ 5,
17
+ '',
18
+ 'vfhe/circuit/gkr/v1/gkr.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dvfhe/circuit/gkr/v1/gkr.proto\x12\x13vfhe.circuit.gkr.v1\"`\n\x07\x43ircuit\x12\x12\n\nnum_inputs\x18\x01 \x01(\r\x12*\n\x06layers\x18\x02 \x03(\x0b\x32\x1a.vfhe.circuit.gkr.v1.Layer\x12\x15\n\rfield_modulus\x18\x03 \x01(\t\"1\n\x05Layer\x12(\n\x05gates\x18\x01 \x03(\x0b\x32\x19.vfhe.circuit.gkr.v1.Gate\"P\n\x04Gate\x12+\n\x04type\x18\x01 \x01(\x0e\x32\x1d.vfhe.circuit.gkr.v1.GateType\x12\x0c\n\x04left\x18\x02 \x01(\r\x12\r\n\x05right\x18\x03 \x01(\r*K\n\x08GateType\x12\x19\n\x15GATE_TYPE_UNSPECIFIED\x10\x00\x12\x11\n\rGATE_TYPE_ADD\x10\x01\x12\x11\n\rGATE_TYPE_MUL\x10\x02\x62\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'vfhe.circuit.gkr.v1.gkr_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ DESCRIPTOR._loaded_options = None
34
+ _globals['_GATETYPE']._serialized_start=285
35
+ _globals['_GATETYPE']._serialized_end=360
36
+ _globals['_CIRCUIT']._serialized_start=54
37
+ _globals['_CIRCUIT']._serialized_end=150
38
+ _globals['_LAYER']._serialized_start=152
39
+ _globals['_LAYER']._serialized_end=201
40
+ _globals['_GATE']._serialized_start=203
41
+ _globals['_GATE']._serialized_end=283
42
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,43 @@
1
+ from google.protobuf.internal import containers as _containers
2
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
3
+ from google.protobuf import descriptor as _descriptor
4
+ from google.protobuf import message as _message
5
+ from collections.abc import Iterable as _Iterable, Mapping as _Mapping
6
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
7
+
8
+ DESCRIPTOR: _descriptor.FileDescriptor
9
+
10
+ class GateType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
11
+ __slots__ = ()
12
+ GATE_TYPE_UNSPECIFIED: _ClassVar[GateType]
13
+ GATE_TYPE_ADD: _ClassVar[GateType]
14
+ GATE_TYPE_MUL: _ClassVar[GateType]
15
+ GATE_TYPE_UNSPECIFIED: GateType
16
+ GATE_TYPE_ADD: GateType
17
+ GATE_TYPE_MUL: GateType
18
+
19
+ class Circuit(_message.Message):
20
+ __slots__ = ("num_inputs", "layers", "field_modulus")
21
+ NUM_INPUTS_FIELD_NUMBER: _ClassVar[int]
22
+ LAYERS_FIELD_NUMBER: _ClassVar[int]
23
+ FIELD_MODULUS_FIELD_NUMBER: _ClassVar[int]
24
+ num_inputs: int
25
+ layers: _containers.RepeatedCompositeFieldContainer[Layer]
26
+ field_modulus: str
27
+ def __init__(self, num_inputs: _Optional[int] = ..., layers: _Optional[_Iterable[_Union[Layer, _Mapping]]] = ..., field_modulus: _Optional[str] = ...) -> None: ...
28
+
29
+ class Layer(_message.Message):
30
+ __slots__ = ("gates",)
31
+ GATES_FIELD_NUMBER: _ClassVar[int]
32
+ gates: _containers.RepeatedCompositeFieldContainer[Gate]
33
+ def __init__(self, gates: _Optional[_Iterable[_Union[Gate, _Mapping]]] = ...) -> None: ...
34
+
35
+ class Gate(_message.Message):
36
+ __slots__ = ("type", "left", "right")
37
+ TYPE_FIELD_NUMBER: _ClassVar[int]
38
+ LEFT_FIELD_NUMBER: _ClassVar[int]
39
+ RIGHT_FIELD_NUMBER: _ClassVar[int]
40
+ type: GateType
41
+ left: int
42
+ right: int
43
+ def __init__(self, type: _Optional[_Union[GateType, str]] = ..., left: _Optional[int] = ..., right: _Optional[int] = ...) -> None: ...
vfhe-0.0.0/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.so
4
+ *.o
5
+ build/
6
+ dist/
7
+ *.egg-info/
8
+
9
+ .generated/
10
+ .cache/
11
+
12
+ # coverage artifacts (pytest --cov)
13
+ .coverage
14
+ .coverage.*
15
+ coverage.xml
16
+ htmlcov/
17
+
18
+ .venv/
19
+ .vscode/
20
+ .idea/
21
+ .DS_Store
vfhe-0.0.0/.gitmessage ADDED
@@ -0,0 +1,11 @@
1
+ # ── Commit message guide (50/72 rule) ──────────────────────────────
2
+ # Subject: imperative, <= 50 chars, capitalized, no trailing period.
3
+ # |<---------- 50 chars: aim to stop near here ---->|
4
+ #
5
+
6
+ # Body (optional): wrap at 72 chars. Explain *what* and *why*, not how.
7
+ # |<---------------------- 72 chars: wrap before here ----------------->|
8
+ #
9
+ # Lines starting with '#' are stripped. This guide is a recommendation,
10
+ # not a rule the tooling enforces. Enable it once with:
11
+ # git config commit.template .gitmessage
vfhe-0.0.0/.gitmodules ADDED
@@ -0,0 +1,6 @@
1
+ [submodule "external/unity"]
2
+ path = external/unity
3
+ url = https://github.com/ThrowTheSwitch/Unity.git
4
+ [submodule "external/blake3"]
5
+ path = external/blake3
6
+ url = https://github.com/BLAKE3-team/BLAKE3.git
vfhe-0.0.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 The VFHE authors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
vfhe-0.0.0/MANIFEST.in ADDED
@@ -0,0 +1,23 @@
1
+ recursive-include modules *.c *.h *.inc *.S *.cdef *.proto
2
+ include native/build_ffi.py
3
+ include native/discovery.py
4
+ include scripts/gen_proto.py
5
+ prune modules/*/python/test
6
+
7
+ # setuptools-scm's file finder otherwise sweeps every git-tracked tree -- both
8
+ # submodules in full, plus CI/dev dirs -- into the sdist. Drop them here, then
9
+ # re-add only the BLAKE3 sources the build actually needs.
10
+ prune external/unity
11
+ prune external/blake3
12
+ prune old-ci
13
+ prune .github
14
+
15
+ # Vendored BLAKE3 (git submodule): its C sources are compiled into the native
16
+ # extension, so they MUST ship inside the sdist. This works only when the
17
+ # submodule is checked out at sdist-build time (CI: checkout submodules: recursive).
18
+ # Unity is intentionally NOT included -- it is test-only, never shipped.
19
+ include external/blake3/c/*.c
20
+ include external/blake3/c/*.h
21
+ include external/blake3/c/*.S
22
+ include external/blake3/LICENSE_A2 external/blake3/LICENSE_A2LLVM external/blake3/LICENSE_CC0
23
+ include NOTICE
vfhe-0.0.0/Makefile ADDED
@@ -0,0 +1,34 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ PYTHON ?= python3
3
+ CLANG_FORMAT ?= clang-format
4
+ SOURCES = modules native scripts setup.py
5
+
6
+ # Never write .pyc anywhere during the dev loop (no __pycache__ in the source).
7
+ export PYTHONDONTWRITEBYTECODE := 1
8
+
9
+ .PHONY: deps format proto build test wheel test-wheel clean
10
+
11
+ deps: ## install the dev dependency group from pyproject (not the package; needs pip >= 25.1)
12
+ $(PYTHON) -m pip install --group dev
13
+
14
+ format: ## format all Python (ruff) and C (clang-format) sources in place
15
+ $(PYTHON) -m ruff format $(SOURCES)
16
+ $(PYTHON) -m ruff check --fix $(SOURCES)
17
+ find modules \( -name '*.c' -o -name '*.h' \) -print0 | xargs -0 $(CLANG_FORMAT) -i
18
+
19
+ proto: ## (re)generate protobuf bindings into .generated/_vfhe_proto/
20
+ $(PYTHON) scripts/gen_proto.py
21
+
22
+ build: proto ## generate proto bindings + compile the native lib/stub into .generated/
23
+ $(PYTHON) native/build_ffi.py
24
+
25
+ test: build ## build, then run the C (Unity) and Python (pytest) test suites
26
+ $(PYTHON) scripts/run_c_tests.py
27
+ $(PYTHON) -m pytest
28
+
29
+ wheel: ## build a wheel for the current platform into dist/
30
+ $(PYTHON) -m build --wheel
31
+
32
+ clean: ## remove all generated/build artifacts and caches
33
+ rm -rf .generated .cache build dist *.egg-info
34
+ find . -name '__pycache__' -type d -prune -exec rm -rf {} +
vfhe-0.0.0/NOTICE ADDED
@@ -0,0 +1,46 @@
1
+ vfhe — Verifiable Fully Homomorphic Encryption
2
+ Copyright the vfhe authors.
3
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
4
+
5
+ This product bundles third-party software, vendored as git submodules under
6
+ external/. Each retains its own copyright and license.
7
+
8
+ - BLAKE3 (cryptographic hash function)
9
+ Upstream: https://github.com/BLAKE3-team/BLAKE3
10
+ License: triple-licensed CC0-1.0 / Apache-2.0 / Apache-2.0-with-LLVM-exception,
11
+ used here under Apache-2.0.
12
+ See external/blake3/LICENSE_A2, LICENSE_A2LLVM, LICENSE_CC0.
13
+ Usage: the c/ sources are compiled into the native extension
14
+ (_vfhe_native) and shipped in released sdists/wheels. Internal
15
+ only — never exposed on the Python API.
16
+
17
+ - Unity (C unit-testing framework)
18
+ Upstream: https://github.com/ThrowTheSwitch/Unity
19
+ License: MIT. See external/unity/LICENSE.txt.
20
+ Usage: test-only. Compiles the C unit tests during development; NOT
21
+ distributed in released sdists or wheels.
22
+
23
+ This product additionally contains code adapted or ported (not vendored) from
24
+ the projects below. Unlike the submodules above, this code was integrated -- in
25
+ places function by function -- into larger source files of the arith and rng
26
+ modules, so it has no separate directory. Both projects are Apache-2.0 licensed,
27
+ matching this project's license.
28
+
29
+ - MOSFHET (FHE library)
30
+ Upstream: https://github.com/antoniocgj/MOSFHET
31
+ License: Apache-2.0 (see upstream LICENSE).
32
+ Usage: modules/rng/c/src/aes_ctr.c is a near-verbatim adaptation of its
33
+ AES-NI counter-mode PRNG. Beyond that, further routines
34
+ (number-theoretic transform, modular arithmetic, and sampling
35
+ helpers) were ported and adapted into larger files across
36
+ modules/arith and modules/rng. Compiled into the native extension.
37
+
38
+ - Intel HEXL (homomorphic-encryption acceleration library)
39
+ Upstream: https://github.com/intel/hexl
40
+ License: Apache-2.0 (see upstream LICENSE).
41
+ Usage: the AVX-512 modular-arithmetic and NTT fast paths adapt HEXL's
42
+ approach -- IFMA / AVX-512 Barrett reduction (52-bit hi/lo madd52
43
+ products) and lazy-reduction butterflies -- integrated into
44
+ modules/arith/c/src/zq/zq_avx512_*.c and
45
+ modules/arith/c/src/ntt/ntt_avx512_*.{c,inc}. Compiled into the
46
+ native extension on AVX-512 builds.