SCrypto alternatives and similar libraries
Based on the "Cryptography" category.
Alternatively, view SCrypto alternatives based on common mentions on social networks and blogs.
CryptoSwift9.8 7.5 L4 SCrypto VS CryptoSwiftCryptoSwift is a growing collection of standard and secure cryptographic algorithms implemented in Swift
RNCryptor9.2 0.0 SCrypto VS RNCryptorCCCryptor (AES encryption) wrappers for iOS and Mac in Swift. -- For ObjC, see RNCryptor/RNCryptor-objc
SwiftShield8.5 1.0 SCrypto VS SwiftShield🔒 Swift Obfuscator that protects iOS apps against reverse engineering attacks.
Themis8.1 5.8 L3 SCrypto VS ThemisEasy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Swift-Sodium6.3 1.0 L5 SCrypto VS Swift-SodiumSafe and easy to use crypto for iOS and macOS
IDZSwiftCommonCrypto5.7 2.8 L4 SCrypto VS IDZSwiftCommonCryptoA wrapper for Apple's Common Crypto library written in Swift.
BlueCryptor4.4 2.8 L2 SCrypto VS BlueCryptorSwift cross-platform crypto library using CommonCrypto/libcrypto
JOSESwift4.3 2.1 SCrypto VS JOSESwiftA framework for the JOSE standards JWS, JWE, and JWK written in Swift.
Siphash4.2 0.0 L3 SCrypto VS SiphashSimple and secure hashing in Swift with the SipHash algorithm
BlueRSA3.9 0.0 SCrypto VS BlueRSARSA public/private key encryption, private key signing and public key verification in Swift using the Swift Package Manager. Works on iOS, macOS, and Linux (work in progress).
SwiftSSL3.8 0.0 L5 SCrypto VS SwiftSSLAn Elegant crypto toolkit in Swift.
AES256CBC3.4 5.0 L4 SCrypto VS AES256CBCMost convenient AES256-CBC encryption for Swift 2
OpenSSL2.1 0.0 L4 SCrypto VS OpenSSLSwift OpenSSL for OS X and Linux
SweetHMAC1.2 0.0 L5 SCrypto VS SweetHMACA tiny and easy to use Swift class to encrypt strings using HMAC algorithms.
Keys1.2 0.0 L4 SCrypto VS KeysUncomplicated cryptography frameworks base on CommonCrypto
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SCrypto or a related project?
[Overview • Requirements • Installation • Usage • Alternatives • Licence]
SCrypto provides neat Swift interface to access the CommonCrypto routines.
- [x] Essential
Stringextensions for message digest, HMAC, PBKDF, symmetric encryption calculation
- [x] Swift 5.1 support
- [x] Cocoapods, Carthage and Swift Package Manager compatible
- [x] Comprehensive Unit Test Coverage
- [x] Complete Documentation
- [x] iOS and OS X support
- iOS 9.0+ / macOS 10.11+
- Swift 3.0+
- Xcode 8.0+
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate SCrypto into your Xcode project using CocoaPods, specify it in your
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0' use_frameworks! pod 'SCrypto', '~> 2.0.0'
Then, run the following command:
$ pod install
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. You can install Carthage with Homebrew using the following command:
$ brew update $ brew install carthage
To integrate SCrypto into your Xcode project using Carthage, specify it in your
github "sgl0v/SCrypto" ~> 1.0.0
carthage update to build the framework and drag the built
SCrypto.framework into your Xcode project.
Swift Package Manager
You can add the SCrypto framework to your project via Swift Package Manager. Add the following line to the dependencies in your
.package(url: "https://github.com/sgl0v/SCrypto", exact: "<latest version>"),
Finally, include "SCrypto" as a dependency for your executable target:
.target(name: "<target name>", dependencies: ["SCrypto"])
If you prefer not to use either of the mentioned dependency managers, you can integrate SCrypto into your project manually.
- Open up Terminal,
cdinto your top-level project directory, and run the following command "if" your project is not initialized as a git repository:
$ git init
- Add SCrypto as a git submodule by running the following command:
$ git submodule add https://github.com/sgl0v/SCrypto.git
Open the new
SCryptofolder, and drag the
SCrypto.xcodeprojinto the Project Navigator of your application's Xcode project.
SCrypto.xcodeprojshould appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
SCrypto.xcodeprojin the Project Navigator and verify the deployment target matches that of your application target.
Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.
In the tab bar at the top of that window, open the "General" panel.
Click on the
+button under the "Embedded Binaries" section.
You will see two different
SCrypto.xcodeprojfolders each with two different versions of the
SCrypto.framework iOSnested inside a
It doesn't matter which
Productsfolder you choose from.
Just select the
SCrypto.framework iOSand that's it!
SCrypto.frameworkis automagically added as a target dependency and should appear as a linked and embedded framework in the
Message Digest (MD5, SHA)
Message digests are secure one-way cryptographic hash functions that take arbitrary-sized data and output a fixed-length hash value.
let sha256 = "message".SHA256()
Keyed-hash message authentication code (HMAC)
Hash-based message authentication codes (or HMACs) provides a way for calculating message authentication codes using a cryptographic hash function coupled with a secret key. You can use an HMAC to verify both the integrity and authenticity of a message. The following standard hash algorithm are supported: SHA1, MD5, SHA256, SHA384, SHA512, SHA224.
let secretKey = try! Data.random(32) let message = "message".data(using: String.Encoding.utf8)! let hmac = message.hmac(.SHA256, key: secretKey)
Pseudorandom number generator (PRNG)
Generates cryptographically strong random bits suitable for use as cryptographic keys, IVs, nonces etc.
let randomBytes = try! Data.random(16)
Symmetric-key algorithms (AES, DES, TripleDES, CAST, RC2, RC4, Blowfish)
Symmetric-key algorithms use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext. Note that symmetric encryption only provides secrecy but not integrity. There are recent encryption modes which combine symmetric encryption and checked integrity (not supported by CommonCrypto). For this reason it is strongly recommended to combine encryption with a HMAC.
Here is the way to encrypt and decrypt data via AES algorithm in CBC mode with PKCS7 Padding:
let plaintext = "plain text".data(using: String.Encoding.utf8)! let sharedSecretKey = "shared_secret_key".data(using: String.Encoding.utf8)!.SHA256() // AES-256 let IV = try! Data.random(16) // Randomly generated IV. Length is equal to the AES block size(128) let ciphertext = try! plaintext.encrypt(.AES, options: .PKCS7Padding, key: sharedSecretKey, iv: IV) let plaintext2 = try! ciphertext.decrypt(.AES, options: .PKCS7Padding, key: sharedSecretKey, iv: IV)
Password-Based Key Derivation Function (PBKDF2)
Key derivation functions are used for turning a passphrase into an arbitrary length key for use as a cryptographic key in subsequent operations.
let password = "password".data(using: String.Encoding.utf8)! let salt = try! Data.random(32) let derivedKey = try! password.derivedKey(salt, pseudoRandomAlgorithm: .SHA256, rounds: 20, derivedKeyLength: 32)
Looking for something else? Try another Swift CommonCrypto wrappers:
SCrypto is MIT-licensed. See
*Note that all licence references and agreements mentioned in the SCrypto README section above are relevant to that project's source code only.