Skip to content

pinkjuice66/ImageCrypto

Repository files navigation

logo example

1.0.0 License: MIT SwiftPM

Features

  • Encrypt and decrypt an image in a safe and a easy way.
  • UIImage, CIImage, image format data(jpeg, png..) supported
  • Good performance(0.3 secs taken for encrypting a 8.6MP image on iPhone X)

Usage

import ImageCrypto 

// encrypt an image
let encryptor = ImageEncryptor()
encryptor.encrypt(data, using: "your key") { result in
    switch result {
    case .success(let image):
        // do what you want with the encrypted image. 
    case .failure(let error):
        print(error)
    }
}

// decrypt an image
let decryptor = ImageDecryptor()
decryptor.decrypt(data, using: "your key") { result in
    switch result {
    case .success(let image):
        // do what you want with the encrypted image. 
    case .failure(let error):
        print(error)
    }
}

Caution

If the encrypted image data change, there’s no way to recover original image.

So never use lossy image format like jpeg for the encrypted image.

Requirements

  • iOS 13.0+
  • Swift 5.6

Installation

Author

Jinseok Park

Distributed under the MIT license. See LICENSE for more information.

About

Image Encryption and Decryption Library for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages