From 6e41ccd8766b1e33a16960451b8b846c786be142 Mon Sep 17 00:00:00 2001 From: Fabian Boemer Date: Mon, 12 Aug 2024 08:32:11 -0700 Subject: [PATCH] Move HomomorphicEncryption under articles. Also fix some documentation links. --- Sources/HomomorphicEncryption/Ciphertext.swift | 2 +- Sources/HomomorphicEncryption/HeScheme.swift | 10 +++++----- .../HomomorphicEncryption.md | 6 ++++-- Sources/HomomorphicEncryption/PolyRq/PolyRq.swift | 2 +- Sources/PIRProcessDatabase/ProcessDatabase.swift | 2 +- .../PrivateInformationRetrieval/IndexPirProtocol.swift | 10 +++++----- .../PrivateInformationRetrieval/KeywordDatabase.swift | 4 ++-- .../KeywordPirProtocol.swift | 5 ++--- swift-homomorphic-encryption-protobuf | 2 +- 9 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Sources/HomomorphicEncryption/Ciphertext.swift b/Sources/HomomorphicEncryption/Ciphertext.swift index 1cf7492a..fe3117c2 100644 --- a/Sources/HomomorphicEncryption/Ciphertext.swift +++ b/Sources/HomomorphicEncryption/Ciphertext.swift @@ -145,7 +145,7 @@ public struct Ciphertext: Equatable, Senda /// Computes whether a ciphertext is transparent. /// /// A *transparent* ciphertext reveals the underlying plaintext to any observer. For instance, - /// ``HeScheme/zeroCiphertext(context:moduliCount:)-52gz2`` yields a transparent transparent. + /// ``Ciphertext/zero(context:moduliCount:)`` yields a transparent transparent. /// - Returns: Whether the ciphertext is transparent. /// - seealso: ``HeScheme/isTransparent(ciphertext:)`` for an alternative API. @inlinable diff --git a/Sources/HomomorphicEncryption/HeScheme.swift b/Sources/HomomorphicEncryption/HeScheme.swift index 357f99df..824de433 100644 --- a/Sources/HomomorphicEncryption/HeScheme.swift +++ b/Sources/HomomorphicEncryption/HeScheme.swift @@ -167,7 +167,7 @@ public protocol HeScheme { /// - format: Encoding format of the plaintext. /// - Returns: The decoded values. /// - Throws: Error upon failure to decode the plaintext. - /// - seealso: ``Plaintext/decode(format:)-9l5kz`` for an alternative API. + /// - seealso: ``Plaintext/decode(format:)-5me1t`` for an alternative API. static func decode(plaintext: CoeffPlaintext, format: EncodeFormat) throws -> [T] /// Decodes a plaintext in ``Eval`` format. @@ -176,7 +176,7 @@ public protocol HeScheme { /// - format: Encoding format of the plaintext. /// - Returns: The decoded values. /// - Throws: Error upon failure to decode the plaintext. - /// - seealso: ``Plaintext/decode(format:)-i9hh`` for an alternative API. + /// - seealso: ``Plaintext/decode(format:)-3dnfa`` for an alternative API. static func decode(plaintext: EvalPlaintext, format: EncodeFormat) throws -> [T] /// Symmetric secret key encryption of a plaintext. @@ -235,7 +235,7 @@ public protocol HeScheme { /// Computes whether a ciphertext is transparent. /// /// A *transparent* ciphertext reveals the underlying plaintext to any observer. For instance, - /// ``HeScheme/zeroCiphertext(context:moduliCount:)-1xec3`` yields a transparent transparent. + /// ``HeScheme/zeroCiphertextCoeff(context:moduliCount:)`` yields a transparent transparent. /// - Parameter ciphertext: Ciphertext whose transparency to compute. /// - Returns: Whether the ciphertext is transparent. /// - seealso: ``Ciphertext/isTransparent()`` for an alternative API. @@ -244,7 +244,7 @@ public protocol HeScheme { /// Computes whether a ciphertext is transparent. /// /// A *transparent* ciphertext reveals the underlying plaintext to any observer. For instance, - /// ``HeScheme/zeroCiphertext(context:moduliCount:)-52gz2`` yields a transparent transparent. + /// ``HeScheme/zeroCiphertextEval(context:moduliCount:)`` yields a transparent transparent. /// - Parameter ciphertext: Ciphertext whose transparency to compute. /// - Returns: Whether the ciphertext is transparent. /// - seealso: ``Ciphertext/isTransparent()`` for an alternative API. @@ -793,7 +793,7 @@ extension HeScheme { /// Computes whether a ciphertext is transparent. /// /// A *transparent* ciphertext reveals the underlying plaintext to any observer. For instance, - /// ``HeScheme/zeroCiphertext(context:moduliCount:)-1xec3`` yields a transparent transparent. + /// ``Ciphertext/zero(context:moduliCount:)`` yields a transparent transparent. /// - Parameter ciphertext: Ciphertext whose transparency to compute. /// - Returns: Whether the ciphertext is transparent. /// - seealso: ``Ciphertext/isTransparent()`` for an alternative API. diff --git a/Sources/HomomorphicEncryption/HomomorphicEncryption.docc/HomomorphicEncryption.md b/Sources/HomomorphicEncryption/HomomorphicEncryption.docc/HomomorphicEncryption.md index 58372c56..8dbbd1ab 100644 --- a/Sources/HomomorphicEncryption/HomomorphicEncryption.docc/HomomorphicEncryption.md +++ b/Sources/HomomorphicEncryption/HomomorphicEncryption.docc/HomomorphicEncryption.md @@ -35,7 +35,9 @@ This scheme can be configured to support post-quantum 128-bit security. > > Consult a cryptography expert when developing and deploying homomorphic encryption applications. -## Articles +## Topics -- +### Articles + - +- diff --git a/Sources/HomomorphicEncryption/PolyRq/PolyRq.swift b/Sources/HomomorphicEncryption/PolyRq/PolyRq.swift index 46643fce..f6fd971b 100644 --- a/Sources/HomomorphicEncryption/PolyRq/PolyRq.swift +++ b/Sources/HomomorphicEncryption/PolyRq/PolyRq.swift @@ -256,7 +256,7 @@ extension PolyRq { /// - Parameters: /// - lhs: Polynomial to add. Must have the same ``PolyContext`` as `rhs`. /// - rhs: Polynomial to add. Must have the same ``PolyContext`` as `lhs`. - /// - Returns: The sum `lhs + rhs` + /// - Returns: The sum `lhs + rhs`. @inlinable public static func + (_ lhs: Self, _ rhs: Self) -> Self { var result = lhs diff --git a/Sources/PIRProcessDatabase/ProcessDatabase.swift b/Sources/PIRProcessDatabase/ProcessDatabase.swift index 1e6664cc..2aef0b2b 100644 --- a/Sources/PIRProcessDatabase/ProcessDatabase.swift +++ b/Sources/PIRProcessDatabase/ProcessDatabase.swift @@ -236,7 +236,7 @@ struct ResolvedArguments: CustomStringConvertible, Encodable { /// - cuckooTableConfig: Cuckoo Table configuration. /// - rlweParameters: RLWE parameters. /// - algorithm: PIR algorithm. - /// - keyCompression: ``EvaluationKey`` compression. + /// - keyCompression: Evaluation key compression. /// - trialsPerShard: Number of test queries per shard. init( inputDatabase: String, diff --git a/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift b/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift index 02f0df96..98772e3e 100644 --- a/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift +++ b/Sources/PrivateInformationRetrieval/IndexPirProtocol.swift @@ -28,9 +28,9 @@ public enum PirAlgorithm: String, CaseIterable, Codable, CodingKeyRepresentable, case mulPir } -/// Which strategy to use for ``EvaluationKey`` compression. +/// Which strategy to use for evaluation key compression. public enum PirKeyCompressionStrategy: String, CaseIterable, Codable, CodingKeyRepresentable, Hashable, Sendable { - /// A middle ground between no compression and ``.maxCompression``. + /// A middle ground between no compression and ``PirKeyCompressionStrategy/maxCompression``. case hybridCompression /// Use as small an evaluation key as possible. @@ -52,7 +52,7 @@ public struct IndexPirConfig: Hashable, Codable, Sendable { public let batchSize: Int /// Whether or not to enable `uneven dimensions` optimization. public let unevenDimensions: Bool - /// ``EvaluationKey`` compression. + /// Evaluation key compression. public let keyCompression: PirKeyCompressionStrategy /// Initializes an ``IndexPirConfig``. @@ -62,7 +62,7 @@ public struct IndexPirConfig: Hashable, Codable, Sendable { /// - dimensionCount: Number of dimensions in database. /// - batchSize: Number of indices in a query to the database. /// - unevenDimensions: Whether or not to enable `uneven dimensions` optimization. - /// - keyCompression: ``EvaluationKey`` compression. + /// - keyCompression: Evaluation key compression. /// - Throws: Error upon invalid configuration parameters. public init( entryCount: Int, @@ -97,7 +97,7 @@ public struct IndexPirParameter: Hashable, Codable, Sendable { public let dimensions: [Int] /// Number of indices in a query to the database. public let batchSize: Int - /// ``EvaluationKey`` configuration. + /// Evaluation key configuration. public let evaluationKeyConfig: EvaluationKeyConfiguration /// The number of dimensions in the database. diff --git a/Sources/PrivateInformationRetrieval/KeywordDatabase.swift b/Sources/PrivateInformationRetrieval/KeywordDatabase.swift index fdfec2e8..0e81968b 100644 --- a/Sources/PrivateInformationRetrieval/KeywordDatabase.swift +++ b/Sources/PrivateInformationRetrieval/KeywordDatabase.swift @@ -271,7 +271,7 @@ public enum ProcessKeywordDatabase { public let encryptionParameters: EncryptionParameters /// PIR algorithm to process with. public let algorithm: PirAlgorithm - /// Strategy for ``EvaluationKey`` compression. + /// Strategy for evaluation key compression. public let keyCompression: PirKeyCompressionStrategy /// Number of test queries per shard. public let trialsPerShard: Int @@ -281,7 +281,7 @@ public enum ProcessKeywordDatabase { /// - databaseConfig: Database configuration. /// - encryptionParameters: Encryption parameters. /// - algorithm: PIR algorithm to process with. - /// - keyCompression: Strategy for ``EvaluationKey`` compression. + /// - keyCompression: Strategy for evaluation key compression. /// - trialsPerShard: Number of test queries per shard. /// - Throws: Error upon invalid arguments public init( diff --git a/Sources/PrivateInformationRetrieval/KeywordPirProtocol.swift b/Sources/PrivateInformationRetrieval/KeywordPirProtocol.swift index d930e173..b53db706 100644 --- a/Sources/PrivateInformationRetrieval/KeywordPirProtocol.swift +++ b/Sources/PrivateInformationRetrieval/KeywordPirProtocol.swift @@ -39,7 +39,7 @@ public struct KeywordPirConfig: Hashable, Codable { /// - dimensionCount: Number of dimensions in the database. /// - cuckooTableConfig: Cuckoo table configuration. /// - unevenDimensions: Whether to enable the `uneven dimensions` optimization. - /// - keyCompression: Strategy for ``EvaluationKey`` compression. + /// - keyCompression: Strategy for evaluation key compression. /// - Throws: Error upon invalid arguments. public init( dimensionCount: Int, @@ -123,8 +123,7 @@ public final class KeywordPirServer: KeywordPirProtoc let subTableSize = processed.database.count / keywordPirParameter.hashFunctionCount let tables = stride(from: 0, to: processed.database.count, by: subTableSize).map { startIndex in PirServer - .Database(plaintexts: Array(processed.database - .plaintexts[startIndex..