Skip to content

Commit

Permalink
Move HomomorphicEncryption under articles.
Browse files Browse the repository at this point in the history
Also fix some documentation links.
  • Loading branch information
fboemer committed Aug 12, 2024
1 parent db8a0b7 commit 6e41ccd
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Sources/HomomorphicEncryption/Ciphertext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public struct Ciphertext<Scheme: HeScheme, Format: PolyFormat>: 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
Expand Down
10 changes: 5 additions & 5 deletions Sources/HomomorphicEncryption/HeScheme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: ScalarType>(plaintext: CoeffPlaintext, format: EncodeFormat) throws -> [T]

/// Decodes a plaintext in ``Eval`` format.
Expand All @@ -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<T: ScalarType>(plaintext: EvalPlaintext, format: EncodeFormat) throws -> [T]

/// Symmetric secret key encryption of a plaintext.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

- <doc:UsingSwiftHomomorphicEncryption>
### Articles
<!-- Snippets are defined in a different "virtual module", requiring manually linking articles here. -->
- <doc:DataFormats>
- <doc:UsingSwiftHomomorphicEncryption>
2 changes: 1 addition & 1 deletion Sources/HomomorphicEncryption/PolyRq/PolyRq.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/PIRProcessDatabase/ProcessDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions Sources/PrivateInformationRetrieval/IndexPirProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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``.
Expand All @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Sources/PrivateInformationRetrieval/KeywordDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public enum ProcessKeywordDatabase {
public let encryptionParameters: EncryptionParameters<Scheme>
/// 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
Expand All @@ -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(
Expand Down
5 changes: 2 additions & 3 deletions Sources/PrivateInformationRetrieval/KeywordPirProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -123,8 +123,7 @@ public final class KeywordPirServer<PirServer: IndexPirServer>: 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..<startIndex + subTableSize]))
.Database(plaintexts: Array(processed.database.plaintexts[startIndex..<startIndex + subTableSize]))
}
self.indexPirServer = try PirServer(parameter: processed.pirParameter, context: context, databases: tables)
return
Expand Down

0 comments on commit 6e41ccd

Please sign in to comment.