Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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
letcrypto=Paillier()letcleartext=BigUInt(123456)letaddend=BigUInt(44)letencryption= crypto.encrypt(cleartext)
encryption.add(addend)letciphertext= encryption.ciphertext
letdecryptedText= 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.)

About

An implementation of Paillier's homomorphic encryption in Swift.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages