Starting Vector serves as the starting point for GSM (Global State Machine) initialization and also acts as the basis for key generation.
Generation of SV proceeds by summing products of field elements {pij} with coefficients aij, after transformation via functions ϕi:
SVi=j=1∑miaij⋅ϕi(pij)
This process assembles SV, essential for cryptographic key generation.
Below is a reference test implementation of the Starting Vector generation.
moduletypeFIELD=sigtype tval zero : tval one : tval add : t -> t -> tval mul : t -> t -> tval sub : t -> t -> tval inv : t -> tval rand : unit -> tendmodulePrimeField:FIELDwithtype t =Z.t = structtype t =Z.tlet prime =Z.(nextprime (one lsl 1024))let zero =Z.zerolet one =Z.onelet add =Z.addlet mul =Z.mullet sub =Z.sublet inv x =Z.invert x primelet rand ()=let bits =Z.numbits prime inlet rec loop ()=let r =Z.(random_bits bits mod prime) inifZ.(r >= prime) then loop ()else rin loop ()endmoduleVector (F:FIELD) =structtype t =F.t listlet init n : t =List.init n (fun _ ->F.rand ())let map2 f a b =List.map2 f a blet reduce =List.fold_left F.add F.zeroendmoduleStartingVector=structmoduleV=Vector(PrimeField)let phi a p =let open PrimeFieldinlet r = rand ()in mul (add (mul a a) r) (add a one)let generate n :PrimeField.t list =let a =V.init n inlet p =V.init n inlet phi_applied =List.map2 phi a p inList.map V.reduce (List.map (fun x ->[x]) phi_applied)end