Latest 0.3.0
Homepage https://github.com/ImKcat/CatCrypto
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0, watchos 2.0, requires ARC
Authors

Logo

LanguageSupport Platform
License

Carthage compatible
CocoaPods Version

Travis CI Status
Codebeat
Codecov
Beerpay

CatCrypto include a series of hashing and encryption functions and more functions in progress!

CatCrypto also contains Swift bindings of Argon2, the password-hashing function that won the Password Hashing Competition (PHC).

Content

Requirements

  • Swift 4+
  • iOS 8.0+
  • macOS 10.10+
  • tvOS 9.0+
  • watchOS 2.0+

Support Functions

Upcoming Functions

  • Advanced Encryption Standard (AES)
  • Data Encryption Standard (DES)
  • Triple DES (3DES)

Usage

Context

Context contains inputs and configures for function crypto.

Change hash length with SHA-2 function crypto:

let sha2Crypto = CatSHA2Crypto()
sha2Crypto.context.hashLength = .bit384

Hashing

Hash function used to map data of arbitrary size to data of fixed size.

Simply hashing string with MD6 function crypto:

let md6Crypto = CatMD6Crypto()
md6Crypto.context.hashLength = .bit512
print(md6Crypto.hash(password: "CatCrypto").hexStringValue())

// 3ad3003383633c40281bb5185424ee56a5a1c6dfa3a0e7c3a9e381c58d253323e146feb3f04cb9ebcde47186e042ce63109b8d19f3ca760ea00c90654eb2b272

Verification

Some hash function support to verify their hashed value.

Verifing with Argon2 function crypto:

let hash = "$argon2i$v=19$m=4096,t=3,p=1$Q2F0Q3J5cHRv$Ad6gXMVLvZ3uQOeTi6nCmU4Ns2/nPDfPD5B3yyebv8k"
let argon2Crypto = CatArgon2Crypto()
argon2Crypto.context.mode = .argon2i
argon2Crypto.context.salt = "CatCrypto"
print(argon2Crypto.verify(hash: hash, password: "CatCrypto").boolValue())

// true

Installation

CatCrypto is available through CocoaPods and Carthage.

CocoaPods

Add the following line to your Podfile:

use_frameworks!

pod 'CatCrypto'

Carthage

Add the following line to your Cartfile:

github "ImKcat/CatCrypto"

Documentation

Interacting

CatCrypto is always trying to support more functions and keep itself easy to use, please reading down below to interacting with CatCrypto.

Need Help

Contribute

If you want to contribute with CatCrypto, please reading Contribute Guidelines at first.

License

CatCrypto is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CatCrypto",
    "version": "0.3.0",
    "summary": "An easy way for hashing and encryption.",
    "description": "CatCrypto include a series of hashing and encryption functions.",
    "homepage": "https://github.com/ImKcat/CatCrypto",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kcat": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ImKcat/CatCrypto.git",
        "tag": "0.3.0"
    },
    "social_media_url": "https://imkcat.com",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0",
        "watchos": "2.0"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*.{h,c,swift}",
    "private_header_files": [
        "Sources/ModuleMaps/Argon2/*.h",
        "Sources/ModuleMaps/MD6/*.h",
        "Sources/ModuleMaps/SHA3/*.h"
    ],
    "preserve_paths": [
        "Sources/ModuleMaps/Argon2",
        "Sources/ModuleMaps/MD6",
        "Sources/ModuleMaps/SHA3",
        "Sources/ModuleMaps/CommonCrypto"
    ],
    "pod_target_xcconfig": {
        "SWIFT_INCLUDE_PATHS[sdk=iphoneos*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/iPhoneOS $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/iPhoneSimulator $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=appletvos*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/AppleTVOS $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=appletvsimulator*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/AppleTVSimulator $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=macosx*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/MacOSX $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=watchos*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/WatchOS $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3",
        "SWIFT_INCLUDE_PATHS[sdk=watchsimulator*]": "$(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/CommonCrypto/WatchSimulator $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/Argon2 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/MD6 $(PODS_TARGET_SRCROOT)/Sources/ModuleMaps/SHA3"
    }
}

Pin It on Pinterest

Share This