Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Module wrapper for CommonCrypto that's importable in Swift

License

Notifications You must be signed in to change notification settings

nkukushkin/CommonCryptoModule

Repository files navigation

CommonCrypto, wrapped in module

WARNING: iTunesConnect may reject apps that are using this module.

It is currently impossible to import CommonCrypto headers from Swift because they aren't modular. You can find several solutions to this issue on StackOverflow, however they require some effort to implement.

This repo's goal is to provide a modular wrapper to the CommonCrypto, so that it can be imported to Swift without any additional work.

Example

import CommonCryptoModule

extension Data {

    public func md5() -> Data {
        var result = Data(count: Int(CC_MD5_DIGEST_LENGTH))
        _ = result.withUnsafeMutableBytes { resultBytes in
            self.withUnsafeBytes { originBytes in
                CC_MD5(originBytes, CC_LONG(count), resultBytes)
            }
        }
        return result
    }
}

Installation

Can be installed manually or via Cocoapods:

pod 'CommonCryptoModule', '~> 1.0.2'

About

Module wrapper for CommonCrypto that's importable in Swift

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published