tfhe 0.2.4 → 0.2.5

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.
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ <p align="center">
2
+ <!-- product name logo -->
3
+ <img width=600 src="https://user-images.githubusercontent.com/5758427/231206749-8f146b97-3c5a-4201-8388-3ffa88580415.png">
4
+ </p>
5
+ <hr/>
6
+ <p align="center">
7
+ <a href="https://docs.zama.ai/tfhe-rs"> 📒 Read documentation</a> | <a href="https://zama.ai/community"> 💛 Community support</a>
8
+ </p>
9
+ <p align="center">
10
+ <!-- Version badge using shields.io -->
11
+ <a href="https://github.com/zama-ai/tfhe-rs/releases">
12
+ <img src="https://img.shields.io/github/v/release/zama-ai/tfhe-rs?style=flat-square">
13
+ </a>
14
+ <!-- Zama Bounty Program -->
15
+ <a href="https://github.com/zama-ai/bounty-program">
16
+ <img src="https://img.shields.io/badge/Contribute-Zama%20Bounty%20Program-yellow?style=flat-square">
17
+ </a>
18
+ </p>
19
+ <hr/>
20
+
21
+
22
+ **TFHE-rs** is a pure Rust implementation of TFHE for boolean and integer
23
+ arithmetics over encrypted data. It includes:
24
+ - a **Rust** API
25
+ - a **C** API
26
+ - and a **client-side WASM** API
27
+
28
+ **TFHE-rs** is meant for developers and researchers who want full control over
29
+ what they can do with TFHE, while not having to worry about the low level
30
+ implementation. The goal is to have a stable, simple, high-performance, and
31
+ production-ready library for all the advanced features of TFHE.
32
+
33
+ ## Getting Started
34
+
35
+ To use the latest version of `TFHE-rs` in your project, you first need to add it as a dependency in your `Cargo.toml`:
36
+
37
+ + For x86_64-based machines running Unix-like OSes:
38
+
39
+ ```toml
40
+ tfhe = { version = "*", features = ["boolean", "shortint", "integer", "x86_64-unix"] }
41
+ ```
42
+
43
+ + For Apple Silicon or aarch64-based machines running Unix-like OSes:
44
+
45
+ ```toml
46
+ tfhe = { version = "*", features = ["boolean", "shortint", "integer", "aarch64-unix"] }
47
+ ```
48
+ Note: users with ARM devices must use `TFHE-rs` by compiling using the `nightly` toolchain.
49
+
50
+
51
+ + For x86_64-based machines with the [`rdseed instruction`](https://en.wikipedia.org/wiki/RDRAND)
52
+ running Windows:
53
+
54
+ ```toml
55
+ tfhe = { version = "*", features = ["boolean", "shortint", "integer", "x86_64"] }
56
+ ```
57
+
58
+ Note: aarch64-based machines are not yet supported for Windows as it's currently missing an entropy source to be able to seed the [CSPRNGs](https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator) used in TFHE-rs
59
+
60
+ Note that when running code that uses `tfhe-rs`, it is highly recommended
61
+ to run in release mode with cargo's `--release` flag to have the best performances possible,
62
+ eg: `cargo run --release`.
63
+
64
+ Here is a full example evaluating a Boolean circuit:
65
+
66
+ ```rust
67
+ use tfhe::boolean::prelude::*;
68
+
69
+ fn main() {
70
+ // We generate a set of client/server keys, using the default parameters:
71
+ let (mut client_key, mut server_key) = gen_keys();
72
+
73
+ // We use the client secret key to encrypt two messages:
74
+ let ct_1 = client_key.encrypt(true);
75
+ let ct_2 = client_key.encrypt(false);
76
+
77
+ // We use the server public key to execute a boolean circuit:
78
+ // if ((NOT ct_2) NAND (ct_1 AND ct_2)) then (NOT ct_2) else (ct_1 AND ct_2)
79
+ let ct_3 = server_key.not(&ct_2);
80
+ let ct_4 = server_key.and(&ct_1, &ct_2);
81
+ let ct_5 = server_key.nand(&ct_3, &ct_4);
82
+ let ct_6 = server_key.mux(&ct_5, &ct_3, &ct_4);
83
+
84
+ // We use the client key to decrypt the output of the circuit:
85
+ let output = client_key.decrypt(&ct_6);
86
+ assert_eq!(output, true);
87
+ }
88
+ ```
89
+
90
+ Another example of how the library can be used with shortints:
91
+
92
+ ```rust
93
+ use tfhe::shortint::prelude::*;
94
+
95
+ fn main() {
96
+ // Generate a set of client/server keys
97
+ // with 2 bits of message and 2 bits of carry
98
+ let (client_key, server_key) = gen_keys(PARAM_MESSAGE_2_CARRY_2);
99
+
100
+ let msg1 = 3;
101
+ let msg2 = 2;
102
+
103
+ // Encrypt two messages using the (private) client key:
104
+ let ct_1 = client_key.encrypt(msg1);
105
+ let ct_2 = client_key.encrypt(msg2);
106
+
107
+ // Homomorphically compute an addition
108
+ let ct_add = server_key.unchecked_add(&ct_1, &ct_2);
109
+
110
+ // Define the Hamming weight function
111
+ // f: x -> sum of the bits of x
112
+ let f = |x:u64| x.count_ones() as u64;
113
+
114
+ // Generate the accumulator for the function
115
+ let acc = server_key.generate_accumulator(f);
116
+
117
+ // Compute the function over the ciphertext using the PBS
118
+ let ct_res = server_key.apply_lookup_table(&ct_add, &acc);
119
+
120
+ // Decrypt the ciphertext using the (private) client key
121
+ let output = client_key.decrypt(&ct_res);
122
+ assert_eq!(output, f(msg1 + msg2));
123
+ }
124
+ ```
125
+
126
+ An example using integer:
127
+
128
+ ```rust
129
+ use tfhe::integer::gen_keys_radix;
130
+ use tfhe::shortint::parameters::PARAM_MESSAGE_2_CARRY_2;
131
+
132
+ fn main() {
133
+ // We create keys to create 16 bits integers
134
+ // using 8 blocks of 2 bits
135
+ let (cks, sks) = gen_keys_radix(&PARAM_MESSAGE_2_CARRY_2, 8);
136
+
137
+ let clear_a = 2382u16;
138
+ let clear_b = 29374u16;
139
+
140
+ let mut a = cks.encrypt(clear_a as u64);
141
+ let mut b = cks.encrypt(clear_b as u64);
142
+
143
+ let encrypted_max = sks.smart_max_parallelized(&mut a, &mut b);
144
+ let decrypted_max: u64 = cks.decrypt(&encrypted_max);
145
+
146
+ assert_eq!(decrypted_max as u16, clear_a.max(clear_b))
147
+ }
148
+ ```
149
+
150
+ ## Contributing
151
+
152
+ There are two ways to contribute to TFHE-rs:
153
+
154
+ - you can open issues to report bugs or typos, or to suggest new ideas
155
+ - you can ask to become an official contributor by emailing [hello@zama.ai](mailto:hello@zama.ai).
156
+ (becoming an approved contributor involves signing our Contributor License Agreement (CLA))
157
+
158
+ Only approved contributors can send pull requests, so please make sure to get in touch before you do!
159
+
160
+ ## Credits
161
+
162
+ This library uses several dependencies and we would like to thank the contributors of those
163
+ libraries.
164
+
165
+ ## Need support?
166
+ <a target="_blank" href="https://community.zama.ai">
167
+ <img src="https://user-images.githubusercontent.com/5758427/231115030-21195b55-2629-4c01-9809-be5059243999.png">
168
+ </a>
169
+
170
+ ## License
171
+
172
+ This software is distributed under the BSD-3-Clause-Clear license. If you have any questions,
173
+ please contact us at `hello@zama.ai`.
174
+
175
+ ## Disclaimers
176
+
177
+ ### Security Estimation
178
+
179
+ Security estimations are done using the
180
+ [Lattice Estimator](https://github.com/malb/lattice-estimator)
181
+ with `red_cost_model = reduction.RC.BDGL16`.
182
+
183
+ When a new update is published in the Lattice Estimator, we update parameters accordingly.
184
+
185
+ ### Side-Channel Attacks
186
+
187
+ Mitigation for side channel attacks have not yet been implemented in TFHE-rs,
188
+ and will be released in upcoming versions.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tfhe",
3
3
  "description": "TFHE-rs is a fully homomorphic encryption (FHE) library that implements Zama's variant of TFHE.",
4
- "version": "0.2.4",
4
+ "version": "0.2.5",
5
5
  "license": "BSD-3-Clause-Clear",
6
6
  "repository": {
7
7
  "type": "git",
package/tfhe.d.ts CHANGED
@@ -387,6 +387,35 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
387
387
 
388
388
  export interface InitOutput {
389
389
  readonly memory: WebAssembly.Memory;
390
+ readonly __wbg_booleanciphertext_free: (a: number) => void;
391
+ readonly __wbg_booleancompressedciphertext_free: (a: number) => void;
392
+ readonly __wbg_booleanclientkey_free: (a: number) => void;
393
+ readonly __wbg_booleanpublickey_free: (a: number) => void;
394
+ readonly __wbg_booleancompressedserverkey_free: (a: number) => void;
395
+ readonly __wbg_booleanparameters_free: (a: number) => void;
396
+ readonly boolean_get_parameters: (a: number, b: number) => void;
397
+ readonly boolean_new_parameters: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
398
+ readonly boolean_new_client_key_from_seed_and_parameters: (a: number, b: number, c: number) => number;
399
+ readonly boolean_new_client_key: (a: number) => number;
400
+ readonly boolean_new_public_key: (a: number) => number;
401
+ readonly boolean_new_compressed_server_key: (a: number) => number;
402
+ readonly boolean_encrypt: (a: number, b: number) => number;
403
+ readonly boolean_encrypt_compressed: (a: number, b: number) => number;
404
+ readonly boolean_decompress_ciphertext: (a: number) => number;
405
+ readonly boolean_encrypt_with_public_key: (a: number, b: number) => number;
406
+ readonly boolean_trivial_encrypt: (a: number, b: number) => number;
407
+ readonly boolean_decrypt: (a: number, b: number) => number;
408
+ readonly boolean_serialize_ciphertext: (a: number, b: number) => void;
409
+ readonly boolean_deserialize_ciphertext: (a: number, b: number, c: number) => void;
410
+ readonly boolean_serialize_compressed_ciphertext: (a: number, b: number) => void;
411
+ readonly boolean_deserialize_compressed_ciphertext: (a: number, b: number, c: number) => void;
412
+ readonly boolean_serialize_client_key: (a: number, b: number) => void;
413
+ readonly boolean_deserialize_client_key: (a: number, b: number, c: number) => void;
414
+ readonly boolean_serialize_public_key: (a: number, b: number) => void;
415
+ readonly boolean_deserialize_public_key: (a: number, b: number, c: number) => void;
416
+ readonly boolean_serialize_compressed_server_key: (a: number, b: number) => void;
417
+ readonly boolean_deserialize_compressed_server_key: (a: number, b: number, c: number) => void;
418
+ readonly __wbg_boolean_free: (a: number) => void;
390
419
  readonly __wbg_shortintciphertext_free: (a: number) => void;
391
420
  readonly __wbg_shortintcompressedciphertext_free: (a: number) => void;
392
421
  readonly __wbg_shortintclientkey_free: (a: number) => void;
@@ -425,39 +454,10 @@ export interface InitOutput {
425
454
  readonly shortint_serialize_compressed_server_key: (a: number, b: number) => void;
426
455
  readonly shortint_deserialize_compressed_server_key: (a: number, b: number, c: number) => void;
427
456
  readonly __wbg_shortint_free: (a: number) => void;
428
- readonly __wbg_booleanciphertext_free: (a: number) => void;
429
- readonly __wbg_booleancompressedciphertext_free: (a: number) => void;
430
- readonly __wbg_booleanclientkey_free: (a: number) => void;
431
- readonly __wbg_booleanpublickey_free: (a: number) => void;
432
- readonly __wbg_booleancompressedserverkey_free: (a: number) => void;
433
- readonly __wbg_booleanparameters_free: (a: number) => void;
434
- readonly boolean_get_parameters: (a: number, b: number) => void;
435
- readonly boolean_new_parameters: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
436
- readonly boolean_new_client_key_from_seed_and_parameters: (a: number, b: number, c: number) => number;
437
- readonly boolean_new_client_key: (a: number) => number;
438
- readonly boolean_new_public_key: (a: number) => number;
439
- readonly boolean_new_compressed_server_key: (a: number) => number;
440
- readonly boolean_encrypt: (a: number, b: number) => number;
441
- readonly boolean_encrypt_compressed: (a: number, b: number) => number;
442
- readonly boolean_decompress_ciphertext: (a: number) => number;
443
- readonly boolean_encrypt_with_public_key: (a: number, b: number) => number;
444
- readonly boolean_trivial_encrypt: (a: number, b: number) => number;
445
- readonly boolean_decrypt: (a: number, b: number) => number;
446
- readonly boolean_serialize_ciphertext: (a: number, b: number) => void;
447
- readonly boolean_deserialize_ciphertext: (a: number, b: number, c: number) => void;
448
- readonly boolean_serialize_compressed_ciphertext: (a: number, b: number) => void;
449
- readonly boolean_deserialize_compressed_ciphertext: (a: number, b: number, c: number) => void;
450
- readonly boolean_serialize_client_key: (a: number, b: number) => void;
451
- readonly boolean_deserialize_client_key: (a: number, b: number, c: number) => void;
452
- readonly boolean_serialize_public_key: (a: number, b: number) => void;
453
- readonly boolean_deserialize_public_key: (a: number, b: number, c: number) => void;
454
- readonly boolean_serialize_compressed_server_key: (a: number, b: number) => void;
455
- readonly boolean_deserialize_compressed_server_key: (a: number, b: number, c: number) => void;
456
- readonly __wbg_boolean_free: (a: number) => void;
457
457
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
458
- readonly __wbindgen_free: (a: number, b: number) => void;
459
- readonly __wbindgen_malloc: (a: number) => number;
460
- readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
458
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
459
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
460
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
461
461
  readonly __wbindgen_exn_store: (a: number) => void;
462
462
  }
463
463
 
@@ -480,4 +480,4 @@ export function initSync(module: SyncInitInput): InitOutput;
480
480
  *
481
481
  * @returns {Promise<InitOutput>}
482
482
  */
483
- export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
483
+ export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
package/tfhe.js CHANGED
@@ -1,8 +1,8 @@
1
1
  let wasm;
2
2
 
3
- const cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
4
 
5
- cachedTextDecoder.decode();
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
6
 
7
7
  let cachedUint8Memory0 = null;
8
8
 
@@ -14,6 +14,7 @@ function getUint8Memory0() {
14
14
  }
15
15
 
16
16
  function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
17
18
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
18
19
  }
19
20
 
@@ -63,19 +64,20 @@ function _assertClass(instance, klass) {
63
64
  }
64
65
 
65
66
  function getArrayU8FromWasm0(ptr, len) {
67
+ ptr = ptr >>> 0;
66
68
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
67
69
  }
68
70
 
69
71
  let WASM_VECTOR_LEN = 0;
70
72
 
71
73
  function passArray8ToWasm0(arg, malloc) {
72
- const ptr = malloc(arg.length * 1);
74
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
73
75
  getUint8Memory0().set(arg, ptr / 1);
74
76
  WASM_VECTOR_LEN = arg.length;
75
77
  return ptr;
76
78
  }
77
79
 
78
- const cachedTextEncoder = new TextEncoder('utf-8');
80
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
79
81
 
80
82
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
81
83
  ? function (arg, view) {
@@ -94,14 +96,14 @@ function passStringToWasm0(arg, malloc, realloc) {
94
96
 
95
97
  if (realloc === undefined) {
96
98
  const buf = cachedTextEncoder.encode(arg);
97
- const ptr = malloc(buf.length);
99
+ const ptr = malloc(buf.length, 1) >>> 0;
98
100
  getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
99
101
  WASM_VECTOR_LEN = buf.length;
100
102
  return ptr;
101
103
  }
102
104
 
103
105
  let len = arg.length;
104
- let ptr = malloc(len);
106
+ let ptr = malloc(len, 1) >>> 0;
105
107
 
106
108
  const mem = getUint8Memory0();
107
109
 
@@ -117,7 +119,7 @@ function passStringToWasm0(arg, malloc, realloc) {
117
119
  if (offset !== 0) {
118
120
  arg = arg.slice(offset);
119
121
  }
120
- ptr = realloc(ptr, len, len = offset + arg.length * 3);
122
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
121
123
  const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
122
124
  const ret = encodeString(arg, view);
123
125
 
@@ -143,8 +145,8 @@ export const BooleanParameterSet = Object.freeze({ Default:0,"0":"Default",TfheL
143
145
  export class Boolean {
144
146
 
145
147
  __destroy_into_raw() {
146
- const ptr = this.ptr;
147
- this.ptr = 0;
148
+ const ptr = this.__wbg_ptr;
149
+ this.__wbg_ptr = 0;
148
150
 
149
151
  return ptr;
150
152
  }
@@ -196,7 +198,7 @@ export class Boolean {
196
198
  */
197
199
  static new_client_key_from_seed_and_parameters(seed_high_bytes, seed_low_bytes, parameters) {
198
200
  _assertClass(parameters, BooleanParameters);
199
- const ret = wasm.boolean_new_client_key_from_seed_and_parameters(seed_high_bytes, seed_low_bytes, parameters.ptr);
201
+ const ret = wasm.boolean_new_client_key_from_seed_and_parameters(seed_high_bytes, seed_low_bytes, parameters.__wbg_ptr);
200
202
  return BooleanClientKey.__wrap(ret);
201
203
  }
202
204
  /**
@@ -205,7 +207,7 @@ export class Boolean {
205
207
  */
206
208
  static new_client_key(parameters) {
207
209
  _assertClass(parameters, BooleanParameters);
208
- const ret = wasm.boolean_new_client_key(parameters.ptr);
210
+ const ret = wasm.boolean_new_client_key(parameters.__wbg_ptr);
209
211
  return BooleanClientKey.__wrap(ret);
210
212
  }
211
213
  /**
@@ -214,7 +216,7 @@ export class Boolean {
214
216
  */
215
217
  static new_public_key(client_key) {
216
218
  _assertClass(client_key, BooleanClientKey);
217
- const ret = wasm.boolean_new_public_key(client_key.ptr);
219
+ const ret = wasm.boolean_new_public_key(client_key.__wbg_ptr);
218
220
  return BooleanPublicKey.__wrap(ret);
219
221
  }
220
222
  /**
@@ -223,7 +225,7 @@ export class Boolean {
223
225
  */
224
226
  static new_compressed_server_key(client_key) {
225
227
  _assertClass(client_key, BooleanClientKey);
226
- const ret = wasm.boolean_new_compressed_server_key(client_key.ptr);
228
+ const ret = wasm.boolean_new_compressed_server_key(client_key.__wbg_ptr);
227
229
  return BooleanCompressedServerKey.__wrap(ret);
228
230
  }
229
231
  /**
@@ -233,7 +235,7 @@ export class Boolean {
233
235
  */
234
236
  static encrypt(client_key, message) {
235
237
  _assertClass(client_key, BooleanClientKey);
236
- const ret = wasm.boolean_encrypt(client_key.ptr, message);
238
+ const ret = wasm.boolean_encrypt(client_key.__wbg_ptr, message);
237
239
  return BooleanCiphertext.__wrap(ret);
238
240
  }
239
241
  /**
@@ -243,7 +245,7 @@ export class Boolean {
243
245
  */
244
246
  static encrypt_compressed(client_key, message) {
245
247
  _assertClass(client_key, BooleanClientKey);
246
- const ret = wasm.boolean_encrypt_compressed(client_key.ptr, message);
248
+ const ret = wasm.boolean_encrypt_compressed(client_key.__wbg_ptr, message);
247
249
  return BooleanCompressedCiphertext.__wrap(ret);
248
250
  }
249
251
  /**
@@ -252,7 +254,7 @@ export class Boolean {
252
254
  */
253
255
  static decompress_ciphertext(compressed_ciphertext) {
254
256
  _assertClass(compressed_ciphertext, BooleanCompressedCiphertext);
255
- const ret = wasm.boolean_decompress_ciphertext(compressed_ciphertext.ptr);
257
+ const ret = wasm.boolean_decompress_ciphertext(compressed_ciphertext.__wbg_ptr);
256
258
  return BooleanCiphertext.__wrap(ret);
257
259
  }
258
260
  /**
@@ -262,7 +264,7 @@ export class Boolean {
262
264
  */
263
265
  static encrypt_with_public_key(public_key, message) {
264
266
  _assertClass(public_key, BooleanPublicKey);
265
- const ret = wasm.boolean_encrypt_with_public_key(public_key.ptr, message);
267
+ const ret = wasm.boolean_encrypt_with_public_key(public_key.__wbg_ptr, message);
266
268
  return BooleanCiphertext.__wrap(ret);
267
269
  }
268
270
  /**
@@ -270,7 +272,7 @@ export class Boolean {
270
272
  * @returns {BooleanCiphertext}
271
273
  */
272
274
  trivial_encrypt(message) {
273
- const ret = wasm.boolean_trivial_encrypt(this.ptr, message);
275
+ const ret = wasm.boolean_trivial_encrypt(this.__wbg_ptr, message);
274
276
  return BooleanCiphertext.__wrap(ret);
275
277
  }
276
278
  /**
@@ -281,7 +283,7 @@ export class Boolean {
281
283
  static decrypt(client_key, ct) {
282
284
  _assertClass(client_key, BooleanClientKey);
283
285
  _assertClass(ct, BooleanCiphertext);
284
- const ret = wasm.boolean_decrypt(client_key.ptr, ct.ptr);
286
+ const ret = wasm.boolean_decrypt(client_key.__wbg_ptr, ct.__wbg_ptr);
285
287
  return ret !== 0;
286
288
  }
287
289
  /**
@@ -292,7 +294,7 @@ export class Boolean {
292
294
  try {
293
295
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
296
  _assertClass(ciphertext, BooleanCiphertext);
295
- wasm.boolean_serialize_ciphertext(retptr, ciphertext.ptr);
297
+ wasm.boolean_serialize_ciphertext(retptr, ciphertext.__wbg_ptr);
296
298
  var r0 = getInt32Memory0()[retptr / 4 + 0];
297
299
  var r1 = getInt32Memory0()[retptr / 4 + 1];
298
300
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -300,9 +302,9 @@ export class Boolean {
300
302
  if (r3) {
301
303
  throw takeObject(r2);
302
304
  }
303
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
305
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
304
306
  wasm.__wbindgen_free(r0, r1 * 1);
305
- return v0;
307
+ return v1;
306
308
  } finally {
307
309
  wasm.__wbindgen_add_to_stack_pointer(16);
308
310
  }
@@ -336,7 +338,7 @@ export class Boolean {
336
338
  try {
337
339
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
338
340
  _assertClass(ciphertext, BooleanCompressedCiphertext);
339
- wasm.boolean_serialize_compressed_ciphertext(retptr, ciphertext.ptr);
341
+ wasm.boolean_serialize_compressed_ciphertext(retptr, ciphertext.__wbg_ptr);
340
342
  var r0 = getInt32Memory0()[retptr / 4 + 0];
341
343
  var r1 = getInt32Memory0()[retptr / 4 + 1];
342
344
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -344,9 +346,9 @@ export class Boolean {
344
346
  if (r3) {
345
347
  throw takeObject(r2);
346
348
  }
347
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
349
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
348
350
  wasm.__wbindgen_free(r0, r1 * 1);
349
- return v0;
351
+ return v1;
350
352
  } finally {
351
353
  wasm.__wbindgen_add_to_stack_pointer(16);
352
354
  }
@@ -380,7 +382,7 @@ export class Boolean {
380
382
  try {
381
383
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
382
384
  _assertClass(client_key, BooleanClientKey);
383
- wasm.boolean_serialize_client_key(retptr, client_key.ptr);
385
+ wasm.boolean_serialize_client_key(retptr, client_key.__wbg_ptr);
384
386
  var r0 = getInt32Memory0()[retptr / 4 + 0];
385
387
  var r1 = getInt32Memory0()[retptr / 4 + 1];
386
388
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -388,9 +390,9 @@ export class Boolean {
388
390
  if (r3) {
389
391
  throw takeObject(r2);
390
392
  }
391
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
393
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
392
394
  wasm.__wbindgen_free(r0, r1 * 1);
393
- return v0;
395
+ return v1;
394
396
  } finally {
395
397
  wasm.__wbindgen_add_to_stack_pointer(16);
396
398
  }
@@ -424,7 +426,7 @@ export class Boolean {
424
426
  try {
425
427
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
428
  _assertClass(public_key, BooleanPublicKey);
427
- wasm.boolean_serialize_public_key(retptr, public_key.ptr);
429
+ wasm.boolean_serialize_public_key(retptr, public_key.__wbg_ptr);
428
430
  var r0 = getInt32Memory0()[retptr / 4 + 0];
429
431
  var r1 = getInt32Memory0()[retptr / 4 + 1];
430
432
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -432,9 +434,9 @@ export class Boolean {
432
434
  if (r3) {
433
435
  throw takeObject(r2);
434
436
  }
435
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
437
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
436
438
  wasm.__wbindgen_free(r0, r1 * 1);
437
- return v0;
439
+ return v1;
438
440
  } finally {
439
441
  wasm.__wbindgen_add_to_stack_pointer(16);
440
442
  }
@@ -468,7 +470,7 @@ export class Boolean {
468
470
  try {
469
471
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
470
472
  _assertClass(server_key, BooleanCompressedServerKey);
471
- wasm.boolean_serialize_compressed_server_key(retptr, server_key.ptr);
473
+ wasm.boolean_serialize_compressed_server_key(retptr, server_key.__wbg_ptr);
472
474
  var r0 = getInt32Memory0()[retptr / 4 + 0];
473
475
  var r1 = getInt32Memory0()[retptr / 4 + 1];
474
476
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -476,9 +478,9 @@ export class Boolean {
476
478
  if (r3) {
477
479
  throw takeObject(r2);
478
480
  }
479
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
481
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
480
482
  wasm.__wbindgen_free(r0, r1 * 1);
481
- return v0;
483
+ return v1;
482
484
  } finally {
483
485
  wasm.__wbindgen_add_to_stack_pointer(16);
484
486
  }
@@ -510,15 +512,16 @@ export class Boolean {
510
512
  export class BooleanCiphertext {
511
513
 
512
514
  static __wrap(ptr) {
515
+ ptr = ptr >>> 0;
513
516
  const obj = Object.create(BooleanCiphertext.prototype);
514
- obj.ptr = ptr;
517
+ obj.__wbg_ptr = ptr;
515
518
 
516
519
  return obj;
517
520
  }
518
521
 
519
522
  __destroy_into_raw() {
520
- const ptr = this.ptr;
521
- this.ptr = 0;
523
+ const ptr = this.__wbg_ptr;
524
+ this.__wbg_ptr = 0;
522
525
 
523
526
  return ptr;
524
527
  }
@@ -533,15 +536,16 @@ export class BooleanCiphertext {
533
536
  export class BooleanClientKey {
534
537
 
535
538
  static __wrap(ptr) {
539
+ ptr = ptr >>> 0;
536
540
  const obj = Object.create(BooleanClientKey.prototype);
537
- obj.ptr = ptr;
541
+ obj.__wbg_ptr = ptr;
538
542
 
539
543
  return obj;
540
544
  }
541
545
 
542
546
  __destroy_into_raw() {
543
- const ptr = this.ptr;
544
- this.ptr = 0;
547
+ const ptr = this.__wbg_ptr;
548
+ this.__wbg_ptr = 0;
545
549
 
546
550
  return ptr;
547
551
  }
@@ -556,15 +560,16 @@ export class BooleanClientKey {
556
560
  export class BooleanCompressedCiphertext {
557
561
 
558
562
  static __wrap(ptr) {
563
+ ptr = ptr >>> 0;
559
564
  const obj = Object.create(BooleanCompressedCiphertext.prototype);
560
- obj.ptr = ptr;
565
+ obj.__wbg_ptr = ptr;
561
566
 
562
567
  return obj;
563
568
  }
564
569
 
565
570
  __destroy_into_raw() {
566
- const ptr = this.ptr;
567
- this.ptr = 0;
571
+ const ptr = this.__wbg_ptr;
572
+ this.__wbg_ptr = 0;
568
573
 
569
574
  return ptr;
570
575
  }
@@ -579,15 +584,16 @@ export class BooleanCompressedCiphertext {
579
584
  export class BooleanCompressedServerKey {
580
585
 
581
586
  static __wrap(ptr) {
587
+ ptr = ptr >>> 0;
582
588
  const obj = Object.create(BooleanCompressedServerKey.prototype);
583
- obj.ptr = ptr;
589
+ obj.__wbg_ptr = ptr;
584
590
 
585
591
  return obj;
586
592
  }
587
593
 
588
594
  __destroy_into_raw() {
589
- const ptr = this.ptr;
590
- this.ptr = 0;
595
+ const ptr = this.__wbg_ptr;
596
+ this.__wbg_ptr = 0;
591
597
 
592
598
  return ptr;
593
599
  }
@@ -602,15 +608,16 @@ export class BooleanCompressedServerKey {
602
608
  export class BooleanParameters {
603
609
 
604
610
  static __wrap(ptr) {
611
+ ptr = ptr >>> 0;
605
612
  const obj = Object.create(BooleanParameters.prototype);
606
- obj.ptr = ptr;
613
+ obj.__wbg_ptr = ptr;
607
614
 
608
615
  return obj;
609
616
  }
610
617
 
611
618
  __destroy_into_raw() {
612
- const ptr = this.ptr;
613
- this.ptr = 0;
619
+ const ptr = this.__wbg_ptr;
620
+ this.__wbg_ptr = 0;
614
621
 
615
622
  return ptr;
616
623
  }
@@ -625,15 +632,16 @@ export class BooleanParameters {
625
632
  export class BooleanPublicKey {
626
633
 
627
634
  static __wrap(ptr) {
635
+ ptr = ptr >>> 0;
628
636
  const obj = Object.create(BooleanPublicKey.prototype);
629
- obj.ptr = ptr;
637
+ obj.__wbg_ptr = ptr;
630
638
 
631
639
  return obj;
632
640
  }
633
641
 
634
642
  __destroy_into_raw() {
635
- const ptr = this.ptr;
636
- this.ptr = 0;
643
+ const ptr = this.__wbg_ptr;
644
+ this.__wbg_ptr = 0;
637
645
 
638
646
  return ptr;
639
647
  }
@@ -648,8 +656,8 @@ export class BooleanPublicKey {
648
656
  export class Shortint {
649
657
 
650
658
  __destroy_into_raw() {
651
- const ptr = this.ptr;
652
- this.ptr = 0;
659
+ const ptr = this.__wbg_ptr;
660
+ this.__wbg_ptr = 0;
653
661
 
654
662
  return ptr;
655
663
  }
@@ -732,7 +740,7 @@ export class Shortint {
732
740
  try {
733
741
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
734
742
  _assertClass(parameters, ShortintParameters);
735
- wasm.shortint_new_client_key_from_seed_and_parameters(retptr, seed_high_bytes, seed_low_bytes, parameters.ptr);
743
+ wasm.shortint_new_client_key_from_seed_and_parameters(retptr, seed_high_bytes, seed_low_bytes, parameters.__wbg_ptr);
736
744
  var r0 = getInt32Memory0()[retptr / 4 + 0];
737
745
  var r1 = getInt32Memory0()[retptr / 4 + 1];
738
746
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -750,7 +758,7 @@ export class Shortint {
750
758
  */
751
759
  static new_client_key(parameters) {
752
760
  _assertClass(parameters, ShortintParameters);
753
- const ret = wasm.shortint_new_client_key(parameters.ptr);
761
+ const ret = wasm.shortint_new_client_key(parameters.__wbg_ptr);
754
762
  return ShortintClientKey.__wrap(ret);
755
763
  }
756
764
  /**
@@ -759,7 +767,7 @@ export class Shortint {
759
767
  */
760
768
  static new_public_key(client_key) {
761
769
  _assertClass(client_key, ShortintClientKey);
762
- const ret = wasm.shortint_new_public_key(client_key.ptr);
770
+ const ret = wasm.shortint_new_public_key(client_key.__wbg_ptr);
763
771
  return ShortintPublicKey.__wrap(ret);
764
772
  }
765
773
  /**
@@ -768,7 +776,7 @@ export class Shortint {
768
776
  */
769
777
  static new_public_key_small(client_key) {
770
778
  _assertClass(client_key, ShortintClientKey);
771
- const ret = wasm.shortint_new_public_key_small(client_key.ptr);
779
+ const ret = wasm.shortint_new_public_key_small(client_key.__wbg_ptr);
772
780
  return ShortintPublicKey.__wrap(ret);
773
781
  }
774
782
  /**
@@ -777,7 +785,7 @@ export class Shortint {
777
785
  */
778
786
  static new_compressed_public_key(client_key) {
779
787
  _assertClass(client_key, ShortintClientKey);
780
- const ret = wasm.shortint_new_compressed_public_key(client_key.ptr);
788
+ const ret = wasm.shortint_new_compressed_public_key(client_key.__wbg_ptr);
781
789
  return ShortintCompressedPublicKey.__wrap(ret);
782
790
  }
783
791
  /**
@@ -786,7 +794,7 @@ export class Shortint {
786
794
  */
787
795
  static new_compressed_public_key_small(client_key) {
788
796
  _assertClass(client_key, ShortintClientKey);
789
- const ret = wasm.shortint_new_compressed_public_key_small(client_key.ptr);
797
+ const ret = wasm.shortint_new_compressed_public_key_small(client_key.__wbg_ptr);
790
798
  return ShortintCompressedPublicKey.__wrap(ret);
791
799
  }
792
800
  /**
@@ -795,7 +803,7 @@ export class Shortint {
795
803
  */
796
804
  static new_compressed_server_key(client_key) {
797
805
  _assertClass(client_key, ShortintClientKey);
798
- const ret = wasm.shortint_new_compressed_server_key(client_key.ptr);
806
+ const ret = wasm.shortint_new_compressed_server_key(client_key.__wbg_ptr);
799
807
  return ShortintCompressedServerKey.__wrap(ret);
800
808
  }
801
809
  /**
@@ -805,7 +813,7 @@ export class Shortint {
805
813
  */
806
814
  static encrypt(client_key, message) {
807
815
  _assertClass(client_key, ShortintClientKey);
808
- const ret = wasm.shortint_encrypt(client_key.ptr, message);
816
+ const ret = wasm.shortint_encrypt(client_key.__wbg_ptr, message);
809
817
  return ShortintCiphertext.__wrap(ret);
810
818
  }
811
819
  /**
@@ -815,7 +823,7 @@ export class Shortint {
815
823
  */
816
824
  static encrypt_small(client_key, message) {
817
825
  _assertClass(client_key, ShortintClientKey);
818
- const ret = wasm.shortint_encrypt_small(client_key.ptr, message);
826
+ const ret = wasm.shortint_encrypt_small(client_key.__wbg_ptr, message);
819
827
  return ShortintCiphertext.__wrap(ret);
820
828
  }
821
829
  /**
@@ -825,7 +833,7 @@ export class Shortint {
825
833
  */
826
834
  static encrypt_compressed(client_key, message) {
827
835
  _assertClass(client_key, ShortintClientKey);
828
- const ret = wasm.shortint_encrypt_compressed(client_key.ptr, message);
836
+ const ret = wasm.shortint_encrypt_compressed(client_key.__wbg_ptr, message);
829
837
  return ShortintCompressedCiphertext.__wrap(ret);
830
838
  }
831
839
  /**
@@ -835,7 +843,7 @@ export class Shortint {
835
843
  */
836
844
  static encrypt_compressed_small(client_key, message) {
837
845
  _assertClass(client_key, ShortintClientKey);
838
- const ret = wasm.shortint_encrypt_compressed_small(client_key.ptr, message);
846
+ const ret = wasm.shortint_encrypt_compressed_small(client_key.__wbg_ptr, message);
839
847
  return ShortintCompressedCiphertext.__wrap(ret);
840
848
  }
841
849
  /**
@@ -844,7 +852,7 @@ export class Shortint {
844
852
  */
845
853
  static decompress_ciphertext(compressed_ciphertext) {
846
854
  _assertClass(compressed_ciphertext, ShortintCompressedCiphertext);
847
- const ret = wasm.shortint_decompress_ciphertext(compressed_ciphertext.ptr);
855
+ const ret = wasm.shortint_decompress_ciphertext(compressed_ciphertext.__wbg_ptr);
848
856
  return ShortintCiphertext.__wrap(ret);
849
857
  }
850
858
  /**
@@ -854,7 +862,7 @@ export class Shortint {
854
862
  */
855
863
  static encrypt_with_public_key(public_key, message) {
856
864
  _assertClass(public_key, ShortintPublicKey);
857
- const ret = wasm.shortint_encrypt_with_public_key(public_key.ptr, message);
865
+ const ret = wasm.shortint_encrypt_with_public_key(public_key.__wbg_ptr, message);
858
866
  return ShortintCiphertext.__wrap(ret);
859
867
  }
860
868
  /**
@@ -864,7 +872,7 @@ export class Shortint {
864
872
  */
865
873
  static encrypt_with_compressed_public_key(public_key, message) {
866
874
  _assertClass(public_key, ShortintCompressedPublicKey);
867
- const ret = wasm.shortint_encrypt_with_compressed_public_key(public_key.ptr, message);
875
+ const ret = wasm.shortint_encrypt_with_compressed_public_key(public_key.__wbg_ptr, message);
868
876
  return ShortintCiphertext.__wrap(ret);
869
877
  }
870
878
  /**
@@ -875,7 +883,7 @@ export class Shortint {
875
883
  static decrypt(client_key, ct) {
876
884
  _assertClass(client_key, ShortintClientKey);
877
885
  _assertClass(ct, ShortintCiphertext);
878
- const ret = wasm.shortint_decrypt(client_key.ptr, ct.ptr);
886
+ const ret = wasm.shortint_decrypt(client_key.__wbg_ptr, ct.__wbg_ptr);
879
887
  return BigInt.asUintN(64, ret);
880
888
  }
881
889
  /**
@@ -886,7 +894,7 @@ export class Shortint {
886
894
  try {
887
895
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
888
896
  _assertClass(ciphertext, ShortintCiphertext);
889
- wasm.shortint_serialize_ciphertext(retptr, ciphertext.ptr);
897
+ wasm.shortint_serialize_ciphertext(retptr, ciphertext.__wbg_ptr);
890
898
  var r0 = getInt32Memory0()[retptr / 4 + 0];
891
899
  var r1 = getInt32Memory0()[retptr / 4 + 1];
892
900
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -894,9 +902,9 @@ export class Shortint {
894
902
  if (r3) {
895
903
  throw takeObject(r2);
896
904
  }
897
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
905
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
898
906
  wasm.__wbindgen_free(r0, r1 * 1);
899
- return v0;
907
+ return v1;
900
908
  } finally {
901
909
  wasm.__wbindgen_add_to_stack_pointer(16);
902
910
  }
@@ -930,7 +938,7 @@ export class Shortint {
930
938
  try {
931
939
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
932
940
  _assertClass(ciphertext, ShortintCompressedCiphertext);
933
- wasm.shortint_serialize_compressed_ciphertext(retptr, ciphertext.ptr);
941
+ wasm.shortint_serialize_compressed_ciphertext(retptr, ciphertext.__wbg_ptr);
934
942
  var r0 = getInt32Memory0()[retptr / 4 + 0];
935
943
  var r1 = getInt32Memory0()[retptr / 4 + 1];
936
944
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -938,9 +946,9 @@ export class Shortint {
938
946
  if (r3) {
939
947
  throw takeObject(r2);
940
948
  }
941
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
949
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
942
950
  wasm.__wbindgen_free(r0, r1 * 1);
943
- return v0;
951
+ return v1;
944
952
  } finally {
945
953
  wasm.__wbindgen_add_to_stack_pointer(16);
946
954
  }
@@ -974,7 +982,7 @@ export class Shortint {
974
982
  try {
975
983
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
976
984
  _assertClass(client_key, ShortintClientKey);
977
- wasm.shortint_serialize_client_key(retptr, client_key.ptr);
985
+ wasm.shortint_serialize_client_key(retptr, client_key.__wbg_ptr);
978
986
  var r0 = getInt32Memory0()[retptr / 4 + 0];
979
987
  var r1 = getInt32Memory0()[retptr / 4 + 1];
980
988
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -982,9 +990,9 @@ export class Shortint {
982
990
  if (r3) {
983
991
  throw takeObject(r2);
984
992
  }
985
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
993
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
986
994
  wasm.__wbindgen_free(r0, r1 * 1);
987
- return v0;
995
+ return v1;
988
996
  } finally {
989
997
  wasm.__wbindgen_add_to_stack_pointer(16);
990
998
  }
@@ -1018,7 +1026,7 @@ export class Shortint {
1018
1026
  try {
1019
1027
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1020
1028
  _assertClass(public_key, ShortintPublicKey);
1021
- wasm.shortint_serialize_public_key(retptr, public_key.ptr);
1029
+ wasm.shortint_serialize_public_key(retptr, public_key.__wbg_ptr);
1022
1030
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1023
1031
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1024
1032
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1026,9 +1034,9 @@ export class Shortint {
1026
1034
  if (r3) {
1027
1035
  throw takeObject(r2);
1028
1036
  }
1029
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
1037
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1030
1038
  wasm.__wbindgen_free(r0, r1 * 1);
1031
- return v0;
1039
+ return v1;
1032
1040
  } finally {
1033
1041
  wasm.__wbindgen_add_to_stack_pointer(16);
1034
1042
  }
@@ -1062,7 +1070,7 @@ export class Shortint {
1062
1070
  try {
1063
1071
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1064
1072
  _assertClass(public_key, ShortintCompressedPublicKey);
1065
- wasm.shortint_serialize_compressed_public_key(retptr, public_key.ptr);
1073
+ wasm.shortint_serialize_compressed_public_key(retptr, public_key.__wbg_ptr);
1066
1074
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1067
1075
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1068
1076
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1070,9 +1078,9 @@ export class Shortint {
1070
1078
  if (r3) {
1071
1079
  throw takeObject(r2);
1072
1080
  }
1073
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
1081
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1074
1082
  wasm.__wbindgen_free(r0, r1 * 1);
1075
- return v0;
1083
+ return v1;
1076
1084
  } finally {
1077
1085
  wasm.__wbindgen_add_to_stack_pointer(16);
1078
1086
  }
@@ -1106,7 +1114,7 @@ export class Shortint {
1106
1114
  try {
1107
1115
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1108
1116
  _assertClass(server_key, ShortintCompressedServerKey);
1109
- wasm.shortint_serialize_compressed_server_key(retptr, server_key.ptr);
1117
+ wasm.shortint_serialize_compressed_server_key(retptr, server_key.__wbg_ptr);
1110
1118
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1111
1119
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1112
1120
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1114,9 +1122,9 @@ export class Shortint {
1114
1122
  if (r3) {
1115
1123
  throw takeObject(r2);
1116
1124
  }
1117
- var v0 = getArrayU8FromWasm0(r0, r1).slice();
1125
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1118
1126
  wasm.__wbindgen_free(r0, r1 * 1);
1119
- return v0;
1127
+ return v1;
1120
1128
  } finally {
1121
1129
  wasm.__wbindgen_add_to_stack_pointer(16);
1122
1130
  }
@@ -1148,15 +1156,16 @@ export class Shortint {
1148
1156
  export class ShortintCiphertext {
1149
1157
 
1150
1158
  static __wrap(ptr) {
1159
+ ptr = ptr >>> 0;
1151
1160
  const obj = Object.create(ShortintCiphertext.prototype);
1152
- obj.ptr = ptr;
1161
+ obj.__wbg_ptr = ptr;
1153
1162
 
1154
1163
  return obj;
1155
1164
  }
1156
1165
 
1157
1166
  __destroy_into_raw() {
1158
- const ptr = this.ptr;
1159
- this.ptr = 0;
1167
+ const ptr = this.__wbg_ptr;
1168
+ this.__wbg_ptr = 0;
1160
1169
 
1161
1170
  return ptr;
1162
1171
  }
@@ -1171,15 +1180,16 @@ export class ShortintCiphertext {
1171
1180
  export class ShortintClientKey {
1172
1181
 
1173
1182
  static __wrap(ptr) {
1183
+ ptr = ptr >>> 0;
1174
1184
  const obj = Object.create(ShortintClientKey.prototype);
1175
- obj.ptr = ptr;
1185
+ obj.__wbg_ptr = ptr;
1176
1186
 
1177
1187
  return obj;
1178
1188
  }
1179
1189
 
1180
1190
  __destroy_into_raw() {
1181
- const ptr = this.ptr;
1182
- this.ptr = 0;
1191
+ const ptr = this.__wbg_ptr;
1192
+ this.__wbg_ptr = 0;
1183
1193
 
1184
1194
  return ptr;
1185
1195
  }
@@ -1194,15 +1204,16 @@ export class ShortintClientKey {
1194
1204
  export class ShortintCompressedCiphertext {
1195
1205
 
1196
1206
  static __wrap(ptr) {
1207
+ ptr = ptr >>> 0;
1197
1208
  const obj = Object.create(ShortintCompressedCiphertext.prototype);
1198
- obj.ptr = ptr;
1209
+ obj.__wbg_ptr = ptr;
1199
1210
 
1200
1211
  return obj;
1201
1212
  }
1202
1213
 
1203
1214
  __destroy_into_raw() {
1204
- const ptr = this.ptr;
1205
- this.ptr = 0;
1215
+ const ptr = this.__wbg_ptr;
1216
+ this.__wbg_ptr = 0;
1206
1217
 
1207
1218
  return ptr;
1208
1219
  }
@@ -1217,15 +1228,16 @@ export class ShortintCompressedCiphertext {
1217
1228
  export class ShortintCompressedPublicKey {
1218
1229
 
1219
1230
  static __wrap(ptr) {
1231
+ ptr = ptr >>> 0;
1220
1232
  const obj = Object.create(ShortintCompressedPublicKey.prototype);
1221
- obj.ptr = ptr;
1233
+ obj.__wbg_ptr = ptr;
1222
1234
 
1223
1235
  return obj;
1224
1236
  }
1225
1237
 
1226
1238
  __destroy_into_raw() {
1227
- const ptr = this.ptr;
1228
- this.ptr = 0;
1239
+ const ptr = this.__wbg_ptr;
1240
+ this.__wbg_ptr = 0;
1229
1241
 
1230
1242
  return ptr;
1231
1243
  }
@@ -1240,15 +1252,16 @@ export class ShortintCompressedPublicKey {
1240
1252
  export class ShortintCompressedServerKey {
1241
1253
 
1242
1254
  static __wrap(ptr) {
1255
+ ptr = ptr >>> 0;
1243
1256
  const obj = Object.create(ShortintCompressedServerKey.prototype);
1244
- obj.ptr = ptr;
1257
+ obj.__wbg_ptr = ptr;
1245
1258
 
1246
1259
  return obj;
1247
1260
  }
1248
1261
 
1249
1262
  __destroy_into_raw() {
1250
- const ptr = this.ptr;
1251
- this.ptr = 0;
1263
+ const ptr = this.__wbg_ptr;
1264
+ this.__wbg_ptr = 0;
1252
1265
 
1253
1266
  return ptr;
1254
1267
  }
@@ -1263,15 +1276,16 @@ export class ShortintCompressedServerKey {
1263
1276
  export class ShortintParameters {
1264
1277
 
1265
1278
  static __wrap(ptr) {
1279
+ ptr = ptr >>> 0;
1266
1280
  const obj = Object.create(ShortintParameters.prototype);
1267
- obj.ptr = ptr;
1281
+ obj.__wbg_ptr = ptr;
1268
1282
 
1269
1283
  return obj;
1270
1284
  }
1271
1285
 
1272
1286
  __destroy_into_raw() {
1273
- const ptr = this.ptr;
1274
- this.ptr = 0;
1287
+ const ptr = this.__wbg_ptr;
1288
+ this.__wbg_ptr = 0;
1275
1289
 
1276
1290
  return ptr;
1277
1291
  }
@@ -1286,15 +1300,16 @@ export class ShortintParameters {
1286
1300
  export class ShortintPublicKey {
1287
1301
 
1288
1302
  static __wrap(ptr) {
1303
+ ptr = ptr >>> 0;
1289
1304
  const obj = Object.create(ShortintPublicKey.prototype);
1290
- obj.ptr = ptr;
1305
+ obj.__wbg_ptr = ptr;
1291
1306
 
1292
1307
  return obj;
1293
1308
  }
1294
1309
 
1295
1310
  __destroy_into_raw() {
1296
- const ptr = this.ptr;
1297
- this.ptr = 0;
1311
+ const ptr = this.__wbg_ptr;
1312
+ this.__wbg_ptr = 0;
1298
1313
 
1299
1314
  return ptr;
1300
1315
  }
@@ -1305,7 +1320,7 @@ export class ShortintPublicKey {
1305
1320
  }
1306
1321
  }
1307
1322
 
1308
- async function load(module, imports) {
1323
+ async function __wbg_load(module, imports) {
1309
1324
  if (typeof Response === 'function' && module instanceof Response) {
1310
1325
  if (typeof WebAssembly.instantiateStreaming === 'function') {
1311
1326
  try {
@@ -1336,7 +1351,7 @@ async function load(module, imports) {
1336
1351
  }
1337
1352
  }
1338
1353
 
1339
- function getImports() {
1354
+ function __wbg_get_imports() {
1340
1355
  const imports = {};
1341
1356
  imports.wbg = {};
1342
1357
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
@@ -1349,22 +1364,26 @@ function getImports() {
1349
1364
  };
1350
1365
  imports.wbg.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
1351
1366
  const ret = getObject(arg1).stack;
1352
- const ptr0 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1353
- const len0 = WASM_VECTOR_LEN;
1354
- getInt32Memory0()[arg0 / 4 + 1] = len0;
1355
- getInt32Memory0()[arg0 / 4 + 0] = ptr0;
1367
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1368
+ const len1 = WASM_VECTOR_LEN;
1369
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
1370
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
1356
1371
  };
1357
1372
  imports.wbg.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
1373
+ let deferred0_0;
1374
+ let deferred0_1;
1358
1375
  try {
1376
+ deferred0_0 = arg0;
1377
+ deferred0_1 = arg1;
1359
1378
  console.error(getStringFromWasm0(arg0, arg1));
1360
1379
  } finally {
1361
- wasm.__wbindgen_free(arg0, arg1);
1380
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1362
1381
  }
1363
1382
  };
1364
1383
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1365
1384
  takeObject(arg0);
1366
1385
  };
1367
- imports.wbg.__wbg_crypto_70a96de3b6b73dac = function(arg0) {
1386
+ imports.wbg.__wbg_crypto_c48a774b022d20ac = function(arg0) {
1368
1387
  const ret = getObject(arg0).crypto;
1369
1388
  return addHeapObject(ret);
1370
1389
  };
@@ -1373,15 +1392,15 @@ function getImports() {
1373
1392
  const ret = typeof(val) === 'object' && val !== null;
1374
1393
  return ret;
1375
1394
  };
1376
- imports.wbg.__wbg_process_dd1577445152112e = function(arg0) {
1395
+ imports.wbg.__wbg_process_298734cf255a885d = function(arg0) {
1377
1396
  const ret = getObject(arg0).process;
1378
1397
  return addHeapObject(ret);
1379
1398
  };
1380
- imports.wbg.__wbg_versions_58036bec3add9e6f = function(arg0) {
1399
+ imports.wbg.__wbg_versions_e2e78e134e3e5d01 = function(arg0) {
1381
1400
  const ret = getObject(arg0).versions;
1382
1401
  return addHeapObject(ret);
1383
1402
  };
1384
- imports.wbg.__wbg_node_6a9d28205ed5b0d8 = function(arg0) {
1403
+ imports.wbg.__wbg_node_1cd7a5d853dbea79 = function(arg0) {
1385
1404
  const ret = getObject(arg0).node;
1386
1405
  return addHeapObject(ret);
1387
1406
  };
@@ -1389,11 +1408,11 @@ function getImports() {
1389
1408
  const ret = typeof(getObject(arg0)) === 'string';
1390
1409
  return ret;
1391
1410
  };
1392
- imports.wbg.__wbg_msCrypto_adbc770ec9eca9c7 = function(arg0) {
1411
+ imports.wbg.__wbg_msCrypto_bcb970640f50a1e8 = function(arg0) {
1393
1412
  const ret = getObject(arg0).msCrypto;
1394
1413
  return addHeapObject(ret);
1395
1414
  };
1396
- imports.wbg.__wbg_require_f05d779769764e82 = function() { return handleError(function () {
1415
+ imports.wbg.__wbg_require_8f08ceecec0f4fee = function() { return handleError(function () {
1397
1416
  const ret = module.require;
1398
1417
  return addHeapObject(ret);
1399
1418
  }, arguments) };
@@ -1405,17 +1424,17 @@ function getImports() {
1405
1424
  const ret = getStringFromWasm0(arg0, arg1);
1406
1425
  return addHeapObject(ret);
1407
1426
  };
1408
- imports.wbg.__wbg_getRandomValues_3774744e221a22ad = function() { return handleError(function (arg0, arg1) {
1427
+ imports.wbg.__wbg_getRandomValues_37fa2ca9e4e07fab = function() { return handleError(function (arg0, arg1) {
1409
1428
  getObject(arg0).getRandomValues(getObject(arg1));
1410
1429
  }, arguments) };
1411
- imports.wbg.__wbg_randomFillSync_e950366c42764a07 = function() { return handleError(function (arg0, arg1) {
1430
+ imports.wbg.__wbg_randomFillSync_dc1e9a60c158336d = function() { return handleError(function (arg0, arg1) {
1412
1431
  getObject(arg0).randomFillSync(takeObject(arg1));
1413
1432
  }, arguments) };
1414
- imports.wbg.__wbg_newnoargs_2b8b6bd7753c76ba = function(arg0, arg1) {
1433
+ imports.wbg.__wbg_newnoargs_581967eacc0e2604 = function(arg0, arg1) {
1415
1434
  const ret = new Function(getStringFromWasm0(arg0, arg1));
1416
1435
  return addHeapObject(ret);
1417
1436
  };
1418
- imports.wbg.__wbg_call_95d1ea488d03e4e8 = function() { return handleError(function (arg0, arg1) {
1437
+ imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
1419
1438
  const ret = getObject(arg0).call(getObject(arg1));
1420
1439
  return addHeapObject(ret);
1421
1440
  }, arguments) };
@@ -1423,19 +1442,19 @@ function getImports() {
1423
1442
  const ret = getObject(arg0);
1424
1443
  return addHeapObject(ret);
1425
1444
  };
1426
- imports.wbg.__wbg_self_e7c1f827057f6584 = function() { return handleError(function () {
1445
+ imports.wbg.__wbg_self_1ff1d729e9aae938 = function() { return handleError(function () {
1427
1446
  const ret = self.self;
1428
1447
  return addHeapObject(ret);
1429
1448
  }, arguments) };
1430
- imports.wbg.__wbg_window_a09ec664e14b1b81 = function() { return handleError(function () {
1449
+ imports.wbg.__wbg_window_5f4faef6c12b79ec = function() { return handleError(function () {
1431
1450
  const ret = window.window;
1432
1451
  return addHeapObject(ret);
1433
1452
  }, arguments) };
1434
- imports.wbg.__wbg_globalThis_87cbb8506fecf3a9 = function() { return handleError(function () {
1453
+ imports.wbg.__wbg_globalThis_1d39714405582d3c = function() { return handleError(function () {
1435
1454
  const ret = globalThis.globalThis;
1436
1455
  return addHeapObject(ret);
1437
1456
  }, arguments) };
1438
- imports.wbg.__wbg_global_c85a9259e621f3db = function() { return handleError(function () {
1457
+ imports.wbg.__wbg_global_651f05c6a0944d1c = function() { return handleError(function () {
1439
1458
  const ret = global.global;
1440
1459
  return addHeapObject(ret);
1441
1460
  }, arguments) };
@@ -1443,30 +1462,30 @@ function getImports() {
1443
1462
  const ret = getObject(arg0) === undefined;
1444
1463
  return ret;
1445
1464
  };
1446
- imports.wbg.__wbg_call_9495de66fdbe016b = function() { return handleError(function (arg0, arg1, arg2) {
1465
+ imports.wbg.__wbg_call_01734de55d61e11d = function() { return handleError(function (arg0, arg1, arg2) {
1447
1466
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
1448
1467
  return addHeapObject(ret);
1449
1468
  }, arguments) };
1450
- imports.wbg.__wbg_buffer_cf65c07de34b9a08 = function(arg0) {
1469
+ imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
1451
1470
  const ret = getObject(arg0).buffer;
1452
1471
  return addHeapObject(ret);
1453
1472
  };
1454
- imports.wbg.__wbg_newwithbyteoffsetandlength_9fb2f11355ecadf5 = function(arg0, arg1, arg2) {
1473
+ imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) {
1455
1474
  const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
1456
1475
  return addHeapObject(ret);
1457
1476
  };
1458
- imports.wbg.__wbg_new_537b7341ce90bb31 = function(arg0) {
1477
+ imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
1459
1478
  const ret = new Uint8Array(getObject(arg0));
1460
1479
  return addHeapObject(ret);
1461
1480
  };
1462
- imports.wbg.__wbg_set_17499e8aa4003ebd = function(arg0, arg1, arg2) {
1481
+ imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
1463
1482
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
1464
1483
  };
1465
- imports.wbg.__wbg_newwithlength_b56c882b57805732 = function(arg0) {
1484
+ imports.wbg.__wbg_newwithlength_e5d69174d6984cd7 = function(arg0) {
1466
1485
  const ret = new Uint8Array(arg0 >>> 0);
1467
1486
  return addHeapObject(ret);
1468
1487
  };
1469
- imports.wbg.__wbg_subarray_7526649b91a252a6 = function(arg0, arg1, arg2) {
1488
+ imports.wbg.__wbg_subarray_13db269f57aa838d = function(arg0, arg1, arg2) {
1470
1489
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
1471
1490
  return addHeapObject(ret);
1472
1491
  };
@@ -1481,13 +1500,13 @@ function getImports() {
1481
1500
  return imports;
1482
1501
  }
1483
1502
 
1484
- function initMemory(imports, maybe_memory) {
1503
+ function __wbg_init_memory(imports, maybe_memory) {
1485
1504
 
1486
1505
  }
1487
1506
 
1488
- function finalizeInit(instance, module) {
1507
+ function __wbg_finalize_init(instance, module) {
1489
1508
  wasm = instance.exports;
1490
- init.__wbindgen_wasm_module = module;
1509
+ __wbg_init.__wbindgen_wasm_module = module;
1491
1510
  cachedInt32Memory0 = null;
1492
1511
  cachedUint8Memory0 = null;
1493
1512
 
@@ -1496,9 +1515,11 @@ function finalizeInit(instance, module) {
1496
1515
  }
1497
1516
 
1498
1517
  function initSync(module) {
1499
- const imports = getImports();
1518
+ if (wasm !== undefined) return wasm;
1500
1519
 
1501
- initMemory(imports);
1520
+ const imports = __wbg_get_imports();
1521
+
1522
+ __wbg_init_memory(imports);
1502
1523
 
1503
1524
  if (!(module instanceof WebAssembly.Module)) {
1504
1525
  module = new WebAssembly.Module(module);
@@ -1506,25 +1527,27 @@ function initSync(module) {
1506
1527
 
1507
1528
  const instance = new WebAssembly.Instance(module, imports);
1508
1529
 
1509
- return finalizeInit(instance, module);
1530
+ return __wbg_finalize_init(instance, module);
1510
1531
  }
1511
1532
 
1512
- async function init(input) {
1533
+ async function __wbg_init(input) {
1534
+ if (wasm !== undefined) return wasm;
1535
+
1513
1536
  if (typeof input === 'undefined') {
1514
1537
  input = new URL('tfhe_bg.wasm', import.meta.url);
1515
1538
  }
1516
- const imports = getImports();
1539
+ const imports = __wbg_get_imports();
1517
1540
 
1518
1541
  if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {
1519
1542
  input = fetch(input);
1520
1543
  }
1521
1544
 
1522
- initMemory(imports);
1545
+ __wbg_init_memory(imports);
1523
1546
 
1524
- const { instance, module } = await load(await input, imports);
1547
+ const { instance, module } = await __wbg_load(await input, imports);
1525
1548
 
1526
- return finalizeInit(instance, module);
1549
+ return __wbg_finalize_init(instance, module);
1527
1550
  }
1528
1551
 
1529
1552
  export { initSync }
1530
- export default init;
1553
+ export default __wbg_init;
package/tfhe_bg.wasm CHANGED
Binary file