Forráskód Böngészése

refactor style for ciphertext and binfhe docs

Rener Oliveira (Ubuntu WSL) 1 éve
szülő
commit
8970d0fab9

+ 56 - 85
include/docstrings/binfhecontext_docs.h

@@ -2,117 +2,88 @@
 #define BINFHECONTEXT_DOCSTRINGS_H
 
 // GenerateBinFHEContext
-const char* binfhe_GenerateBinFHEContext_parset_docs = R"doc(
+const char* binfhe_GenerateBinFHEContext_parset_docs = R"pbdoc(
     Creates a crypto context using predefined parameter sets. Recommended for most users.
 
-    Parameters:
-    ----------
-    set : BINFHE_PARAMSET
-        The parameter set: TOY, MEDIUM, STD128, STD192, STD256.
-    method : BINFHE_METHOD
-        The bootstrapping method (DM or CGGI).
-
-    Returns:
-    --------
-    CryptoContext
-        The created crypto context.
-)doc";
+    :param set: The parameter set: TOY, MEDIUM, STD128, STD192, STD256.
+    :type set: BINFHE_PARAMSET
+    :param method: The bootstrapping method (DM or CGGI).
+    :type method: BINFHE_METHOD
+    :return: The created crypto context.
+    :rtype: BinFHEContext
+)pbdoc";
 
 // KeyGen
-const char* binfhe_KeyGen_docs = R"doc(
+const char* binfhe_KeyGen_docs = R"pbdoc(
     Generates a secret key for the main LWE scheme.
 
-    Returns:
-    --------
-    LWEPrivateKey
-        The secret key.
-)doc";
+    :return: The secret key.
+    :rtype: LWEPrivateKey
+)pbdoc";
 
 // BTKeyGen
-const char* binfhe_BTKeyGen_docs = R"doc(
+const char* binfhe_BTKeyGen_docs = R"pbdoc(
     Generates bootstrapping keys.
 
-    Parameters:
-    -----------
-    sk : LWEPrivateKey
-        The secret key.
-)doc";
+    :param sk: The secret key.
+    :type sk: LWEPrivateKey
+)pbdoc";
 
 // Encrypt
-const char* binfhe_Encrypt_docs = R"doc(
+const char* binfhe_Encrypt_docs = R"pbdoc(
     Encrypts a bit using a secret key (symmetric key encryption).
 
-    Parameters:
-    -----------
-    sk : LWEPrivateKey
-        The secret key.
-    m : int
-        The plaintext.
-    output : BINFHE_OUTPUT
-        FRESH to generate a fresh ciphertext, BOOTSTRAPPED to generate a refreshed ciphertext (default).
-    p : int
-        Plaintext modulus (default 4).
-    mod : int
-        Encrypt according to mod instead of m_q if mod != 0.
-
-    Returns:
-    --------
-    LWECiphertext
-        The ciphertext.
-)doc";
+    :param sk: The secret key.
+    :type sk: LWEPrivateKey
+    :param m: The plaintext.
+    :type m: int
+    :param output: FRESH to generate a fresh ciphertext, BOOTSTRAPPED to generate a refreshed ciphertext (default).
+    :type output: BINFHE_OUTPUT
+    :param p: Plaintext modulus (default 4).
+    :type p: int
+    :param mod: Encrypt according to mod instead of m_q if mod != 0.
+    :type mod: int
+    :return: The ciphertext.
+    :rtype: LWECiphertext
+)pbdoc";
 
 // Decrypt
-const char* binfhe_Decrypt_docs = R"doc(
+const char* binfhe_Decrypt_docs = R"pbdoc(
     Decrypts a ciphertext using a secret key.
 
-    Parameters:
-    -----------
-    sk : LWEPrivateKey
-        The secret key.
-    ct : LWECiphertext
-        The ciphertext.
-    p : int
-        Plaintext modulus (default 4).
-
-    Returns:
-    --------
-    int
-        The plaintext.
-)doc";
+    :param sk: The secret key.
+    :type sk: LWEPrivateKey
+    :param ct: The ciphertext.
+    :type ct: LWECiphertext
+    :param p: Plaintext modulus (default 4).
+    :type p: int
+    :return: The plaintext.
+    :rtype: int
+)pbdoc";
 
 // EvalBinGate
-const char* binfhe_EvalBinGate_docs = R"doc(
+const char* binfhe_EvalBinGate_docs = R"pbdoc(
     Evaluates a binary gate (calls bootstrapping as a subroutine).
 
-    Parameters:
-    -----------
-    gate : BINGATE
-        The gate; can be AND, OR, NAND, NOR, XOR, or XNOR.
-    ct1 : LWECiphertext
-        First ciphertext.
-    ct2 : LWECiphertext
-        Second ciphertext.
-
-    Returns:
-    --------
-    LWECiphertext
-        The resulting ciphertext.
-)doc";
+    :param gate: The gate; can be AND, OR, NAND, NOR, XOR, or XNOR.
+    :type gate: BINGATE
+    :param ct1: First ciphertext.
+    :type ct1: LWECiphertext
+    :param ct2: Second ciphertext.
+    :type ct2: LWECiphertext
+    :return: The resulting ciphertext.
+    :rtype: LWECiphertext
+)pbdoc";
 
 // EvalNOT
-const char* binfhe_EvalNOT_docs = R"doc(
+const char* binfhe_EvalNOT_docs = R"pbdoc(
     Evaluates the NOT gate.
 
-    Parameters:
-    -----------
-    ct : LWECiphertext
-        The input ciphertext.
-
-    Returns:
-    --------
-    LWECiphertext
-        The resulting ciphertext.
-)doc";
+    :param ct: The input ciphertext.
+    :type ct: LWECiphertext
+    :return: The resulting ciphertext.
+    :rtype: LWECiphertext
+)pbdoc";
 
 
 #endif // BINFHECONTEXT_DOCSTRINGS_H

+ 13 - 12
include/docstrings/ciphertext_docs.h

@@ -1,19 +1,20 @@
 #ifndef CIPHERTEXT_DOCSTRINGS_H
 #define CIPHERTEXT_DOCSTRINGS_H
 
-const char* ctx_GetLevel_docs = R"doc(
-    Get the number of scalings performed
+// GetLevel
+const char* ctx_GetLevel_docs = R"pbdoc(
+    Get the number of scalings performed.
 
-    Returns
-    -------
-        int: The level of the ciphertext.
-)doc";
+    :return: The level of the ciphertext.
+    :rtype: int
+)pbdoc";
 
-const char* ctx_SetLevel_docs = R"doc(
-    Set the number of scalings
+// SetLevel
+const char* ctx_SetLevel_docs = R"pbdoc(
+    Set the number of scalings.
+
+    :param level: The level to set.
+    :type level: int
+)pbdoc";
 
-    Parameters
-    ----------
-        level (int): The level to set.
-)doc";
 #endif // CIPHERTEXT_DOCSTRINGS_H