Exporting full kyber
As mentioned in "Sharing Kyber", sometimes, you want to export the FULL kyber to save it and reuse it later.
Exporting
To export theKyber object, you just transform it to a JSON string:
import nim_kyber/big
var k: Kyber = createRandomKyber(); # Create the kyber object
var str: string = k.exportFullKyber(); # Get the JSON stringNow share the str variable, which can be imported as done in the next example.
Importing
To import the Kyber object from a string, use importFullKyber.
import nim_kyber/big
var str = "..." # The exported JSON string
var k: Kyber = importFullKyber(str);Now you can use k.recieveMessage, k.public, all functionalities of the Kyber object mentioned in this documentation.
Last updated