Here you can find clear and readable implementations of various common Cryptography routines, in pure Swift.
Note that this code SHOULD NOT AT ALL be used for production or security-critical applications. Rather, the purpose of Swift Crypto Routines is to have clear, readable, and beautiful code to best explain practical Cryptography. Hence, most of this code is horribly slow compared to actual crypto libraries, and the time has not been taken to verify its security. However, the routines should be correct.
Please peruse the collection of implemented routines, and their linked specifications below. Lastly, pull requests with fixes, improvements, or new routines are welcome!
- AES-128, AES-192, AES-256: The most common block cipher in use today. PDF Specification
If you want to see a demo of this working, just clone the repository, open the project with Xcode, and run the unit tests.
To use this in a project, just add it to your Package.swift
file:
.Package(url: "https://github.com/donald-pinckney/Swift-Crypto-Routines", Version(1, 0, 1))