Determination of the noise basis for the successful disposal of various types of operations in HFHE.
Defining the active base (computation base) and data structures in the "shifted" space on hypergraphs has its own mechanics built on the map of states. States are redefined by creating a base from the previous map. The new base model must be proven and exhibit characteristics of completeness.
All elements must be placed within the given values and must be integral. The larger the gap between elements, the longer the base for the ciphertext, the more complex the approach to achieving convergence (and vice versa).
Creating a lattice differs from accepted standards and requires redefinition for successful implementation of all necessary functionality. We will not consider the entire process of generating the starting space for managing vectors with encrypted values, but we will outline the basic principles that lie in this area. Such lattice-tables are the basis for any types of operations with ciphers.
This example does not consider the validation system because it requires a separate explanation and additional examples using the mechanics of accounting for all types of keys, such as the bootstrapping key, public key, etc. These mechanisms will be similarly considered in the corresponding articles.
Some numbers that are given are values obtained by approximation. Approximation was achieved by searching through a pre-selected range (approximate ideal values) to achieve the most effective and fastest operations.
The algorithm for creating a basis can be reduced to several actions:
Initialization of hash tables with specified parameters (obtaining values will be discussed separately).
Computation of factorials and combinations to determine states and construct paths for a future lattice space. The combinatorial combination of two parameters: xRlow and xWlow, are positions in the lattice.
The factorial of the sum in the numerator calculates all the options for the permutation in the previously specified space, the product of the factorials of each option reducing this number to the combinations defined in the denominator.
C(xRlow,xWlow)=xRlow!⋅xWlow!(xRlow+xWlow)!
Determination of the noise base, the indices of which are adjusted through recursive checking with the adaptation of xR_low and xW_low:
Division and rounding down are used to ensure the result is integer.
newxRlow=⌊xWlowxRlow⋅(xWlow−1)+⌊2xWlow⌋⌋
Performing logarithmic operations to find criteria for stopping recursive functions:
The version of the product code responsible for this mechanism. Some parameters (such as the lookup table and sets of approximated values) were excluded from the example due to the large number of preset elements, but will be considered and described in separate articles.
(* other part *)typelattice_base={next_cipher: (int, int) Hashtbl.t;xF_val: int;xZ_val: int;max: int array;graph_gaps: (int, (int * int * int) list) Hashtbl.t;}letcompute_graphxR_lowxW_lowxF_valxZ_valmaxgraph_gaps=letfactn=Z.factorial (Z.of_int n) inletnum_states=if xR_low < xW_low then compute_graph xW_low xR_low xF_val xZ_val max graph_gapselseif xR_low <0|| xW_low <0|| xR_low >= xZ_val || xW_low >= xZ_val || xW_low >= xF_val || xR_low >= max.(xW_low)then0elseletnumerator= fact (xR_low + xW_low) inletdenominator= (fact xR_low) * (fact xW_low) inZ.to_int (numerator / denominator)in num_statesletcountxR_low=if xR_low >2thenZ.to_int (Z.log2 (Z.of_int xR_low) /6-Z.of_int 1)else xR_lowletrecnoise_basexR_lowxW_lowmaxgraph_gaps=match max with|0->if xR_low < xW_low then noise_base xW_low xR_low (1- max) graph_gapselse beginletnew_xW_low=if max =1then xW_low +1else xW_lowinletnew_xR_low= ref (count xR_low) inwhile not (Hashtbl.mem graph_gaps !new_xR_low) || not (Hashtbl.mem (Hashtbl.find graph_gaps !new_xR_low) new_xW_low)doif new_xW_low <2then new_xR_low :=!new_xR_low -1else begin new_xR_low :=Z.to_int ((Z.of_int !new_xR_low * (Z.of_int new_xW_low -Z.of_int 1) + (Z.of_int new_xW_low /Z.of_int 2)) /Z.of_int new_xW_low); new_xW_low :=!new_xW_low -1 enddone; (!new_xR_low,!new_xW_low) end|1->if xR_low < xW_low then noise_base xW_low xR_low (1- max) graph_gapselse beginletnew_xW_low= xW_low +1inletnew_xR_low= ref (count xR_low) inwhile not (Hashtbl.mem graph_gaps !new_xR_low) || not (Hashtbl.mem (Hashtbl.find graph_gaps !new_xR_low) new_xW_low)doif new_xW_low <2then new_xR_low :=!new_xR_low -1else begin new_xR_low :=Z.to_int ((Z.of_int !new_xR_low * (Z.of_int new_xW_low -Z.of_int 1) + (Z.of_int new_xW_low /Z.of_int 2)) /Z.of_int new_xW_low); new_xW_low := new_xW_low -1 enddone; (!new_xR_low,!new_xW_low) end|_-> (xR_low, xW_low)letcompute_ilog_table()=letilog_table=Array.make 0inletrecloopxacc=if x <4566thenArray.blit acc 0 ilog_table 04566elseletnumerator=lsr (2* x -1)) inletacc'=Array.append acc [|numerator lsr24|]in loop (x +1) acc'in loop 2[||]; ilog_tableletlattice_determinant()=letnext_cipher=Hashtbl.create 1024inletxF_val=5inletxZ_val=64inletmax=[|412;451;131;60;51|]inletgraph_gaps=Hashtbl.create xZ_val inletrecinit_graph_gapsi=if i < xZ_val then beginHashtbl.add graph_gaps i []; init_graph_gaps (i +1) endin init_graph_gaps 0;letrecupdate_graph_gapsacci=if i < xZ_val thenletupdate_stateaccxW_low=letxR_low= i - xW_low inletbase= compute_graph xR_low xW_low xF_val xZ_val max graph_gaps inmatch base with|0-> acc|_->letcurrent_state=match acc with|None->0|Somec-> cinHashtbl.add (Hashtbl.find graph_gaps xR_low) xW_low (current_state, base); current_state + basein update_graph_gaps (Some (List.fold_left update_state acc (List.init (i +1) (funx-> x)))) (i +1)else accinletcurrent= update_graph_gaps None0inletrecupdate_ciphercurrenti=if i < xZ_val thenletupdate_cipher_helpercurrentxW_low=letxR_low= i - xW_low inmatchHashtbl.find_opt (Hashtbl.find graph_gaps xR_low) xW_low with|Some (base,num_states) ->if num_states =0then currentelseletupdate_next_cipheraccj=letxr0,xw0,xr1,xw1,base_R,base_W=if current <15thenletxr0= xR_low +1inletxw0= xW_low inletxr1= xR_low inletxw1= xW_low +1inletbase_R= base + current - base inletbase_W= base + current - base +if xR_low >0thenHashtbl.find (Hashtbl.find graph_gaps (xR_low -1)) (xW_low +1) else0in (xr0, xw0, xr1, xw1, base_R, base_W)elseif num_states <>0thenletxr0,xw0= noise_base xR_low xW_low 0 graph_gaps inletxr1,xw1= noise_base xR_low xW_low 1 graph_gaps inletbase_R= base inletbase_W= base +if num_states >1then1else0in (xr0, xw0, xr1, xw1, base_R, base_W)else (xR_low, xW_low, xR_low, xW_low, base, base)inletcurrent_state=match acc with|None->0|Somec-> cinHashtbl.add next_cipher (current_state *4) base_R;Hashtbl.add next_cipher (current_state *4+1) base_W;Hashtbl.add next_cipher (current_state *4+2) xR_low;Hashtbl.add next_cipher (current_state *4+3) xW_low; current_state +1in update_cipher_helper (Some (List.fold_left update_next_cipher None (List.init num_states (funx-> x)))) (xW_low +1)|None-> accin update_cipher (update_cipher_helper current 0) (i +1)else()in update_cipher current 0;{next_cipher;xF_val;xZ_val;max;graph_gaps}