apple / swift-crypto
git clone https://github.com/apple/swift-crypto.git
5.0.3 Β· 2d ago
π₯ on GitHub Trending today
Swift implementation of a large part of Apple's CryptoKit API for Linux and ARM64 Windows, backed by vendored BoringSSL and XKCP.
Why you might care
Lets Swift code on non-Apple platforms use the CryptoKit API unchanged, delegating to CryptoKit on Apple platforms. Useful for cross-platform and server apps that need the same crypto calls everywhere. Adds CryptoExtras for server-oriented primitives not in CryptoKit.
+1
stars, 24h Β· #13,815
+1
stars, 7 days Β· #32,143
+8
stars, 30 days Β· #35,715
1.7k
β
total Β· +0% this week
236
forks Β· 35 open issues
Star history (as recorded here)
LanguageAssembly
LicenseApache-2.0
Created2019-07-23 (7y ago)
Last pushtoday
Watchers41
OwnerOrganization
Seen on GitHub Trending
- 2026-10-23 β #6 daily in assembly
- 2026-10-23 β #9 monthly in assembly Β· +8 β
- 2026-10-23 β #3 weekly in assembly Β· +1 β
- 2026-10-22 β #3 daily in assembly
- 2026-10-22 β #9 monthly in assembly Β· +8 β
- 2026-10-22 β #4 weekly in assembly Β· +1 β
- 2026-10-21 β #3 daily in assembly
- 2026-10-21 β #8 monthly in assembly Β· +8 β
- 2026-10-21 β #5 weekly in assembly Β· +1 β
- 2026-10-20 β #3 daily in assembly Β· +1 β
- 2026-10-20 β #8 monthly in assembly Β· +9 β
- 2026-10-20 β #5 weekly in assembly Β· +3 β
GitHub topics
Links
- GitHub: github.com/apple/swift-crypto
- Homepage: https://swiftpackageindex.com/apple/swift-crypto/documentation/crypto
- Releases Β· Issues Β· Hacker News mentions
README excerpt
# Swift Crypto Swift Crypto is an open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux and ARM64 Windows platforms. It enables cross-platform or server applications with the advantages of CryptoKit. ## Using Swift Crypto Swift Crypto is available as a Swift Package Manager package. To use it, add the following dependency in your `Package.swift`: [code] and to your target, add `Crypto` to your dependencies. You can then `import Crypto` to get access to Swift Crypto's functionality. ## Functionality Swift Crypto exposes the portions of the CryptoKit API that do not rely on specialised hardware to any Swift application. It provides safe APIs that abstract over the complexity of many cryptographic primitives that need to be used in modern applications. These APIs encourage safe usages of the underlying primitives, follow cryptographic best practices, and should be the first choice for building applications that need to use cryptography. The current features of Swift Crypto cover key exchange, key derivation, encryption and decryption, hashing, message authentication, and more. For specific API documentation, please see our documentation. ## Implementation Swift Crypto compiles in two distinct modes depending on the platform for which it is being built. When building Swift Crypto for use on an Apple platform where CryptoKit is already available, Swift Crypto compiles its entire API surface down to nothing and simply re-exports the API of CryptoKit. This means that when using Apple platforms Swift Crypto simply delegates all work to the core implementation of CryptoKit, as though Swift Crypto was not even there. When building Swift Crypto for use on other platforms, Swift Crypto builds substantially more code. In particular, we build: 1. A vendored copy of BoringSSL's libcrypto. 2. A vendored copy of XKCP's libXKCP. 3. The common API of Swift Crypto and CryptoKit. 4. The backing implementation of this common API, which calls into BoringSSL or XKCP. The API code, and some cryptographic primitives which are directly implemented in Swift, are exactly the same for both Apple CryptoKit and Swift Crypto. The BoringSSL/XKCP backing implementation is unique to Swift Crypto. In addition, there is another product, `CryptoExtras`, which provides additional functionality that is not offered in CryptoKit, which contains cryptographic APIs predominantly useful in the server ecosystem. **Note**: if you depend on CryptoExtras you'll bundle the BoringSSL/XKCP implementation of the library in your application, no matter the platform. ## Evolution The vast majority of the Swift Crypto code is intended to remain in lockstep with the current version of Apple CryptoKit. For this reason, patches that extend the API of Swift Crypto will be evaluated cautiously. For any such extension there are two possible outcomes for adding the API. Firstly, if the API is judged to be generally valuable and suitable for contribution t
Blurb generated by claude-haiku-5-5 today. Star deltas marked ~ are extrapolated from partial history.