Swiftpack.co - code28/SwiftPaillier as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by code28.
code28/SwiftPaillier 1.0.1
An implementation of Paillier's homomorphic encryption in Swift.
⭐️ 2
🕓 2 years ago
.package(url: "https://github.com/code28/SwiftPaillier.git", from: "1.0.1")

SwiftPaillier

An implementation of Paillier's homomorphic encryption in Swift. It's made for scientific purposes, so be careful when using this library.

Installation via SPM

Declare a dependency on this package inside your Package.swift:

.package(url: "https://github.com/code28/SwiftPaillier.git", from: "1.0.0"),
// ...
.target(..., dependencies: [..., "SwiftPaillier"]),

Usage

import BigInt
import SwiftPaillier

let crypto = Paillier()
let cleartext = BigUInt(123456)
let addend = BigUInt(44)

let encryption = crypto.encrypt(cleartext)
encryption.add(addend)
let ciphertext = encryption.ciphertext

let decryptedText = crypto.decrypt(ciphertext: ciphertext)
assert((cleartext + addend) == decryptedText)

License

This package is licensed under the MIT license. By default it uses GMP, which is licensed under GNU LGPLv3, and BigInt, which is MIT licensed.

Since GMP is dynamically linked, this conforms to the GNU LGPLv3, but pay attention to the conditions of the LGPLv3 when using this library.

(It is possible to use SwiftPaillier without GMP and only use BigInt, which is slower.)

GitHub

link
Stars: 2
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

SwiftPaillier 1.0.0
4 years ago

First release

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics