Skip to content

🔒 A swift µ framework for secret string constant obfuscation

License

Notifications You must be signed in to change notification settings

thexande/Obfuscator

Repository files navigation

Obfuscator

A method to obfuscate strings in Swift.

Swift Version Platform PRs Welcome

Requirements

  • iOS 9.0+
  • Xcode 10

Installation

CocoaPods

You can use CocoaPods to install Obfuscator by adding it to your Podfile (the branch and git url won't be nessessary for long, stay tuned):

platform :ios, '9.0'
use_frameworks!
pod 'Obfuscator', :git => 'https://github.com/thexande/Obfuscator', :tag => '1.0.0'

Manually

  1. Download and drop Obfuscator.swift in your project.
  2. Congratulations!

Usage

  1. Add the class to your project, init the object and call func bytesByObfuscatingString(string: String) -> [UInt8]
final class ViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        let obfuscator = Obfuscator()
        print(obfuscator.bytesByObfuscatingString(string: "your_secret_string_here"))
    }
}
  1. Retrieve your secret byte array from the console, and create a static container to hold it (enum to prevent init):
enum ObfuscatedConstants {
    static let obfuscatedString: [UInt8] = [34, 17, 93, 37, 21, 28, 72, 23, 20, 22, 72, 127, 98, 123, 87, 94, 92, 83, 76, 113]
}
  1. Call and use (example with Google Ad SDK here).
let secret = Obfuscator().reveal(key: ObfuscatedConstants.obfuscatedString)
  1. Party 🎉

Contribute

We would love you for the contribution to Obfuscator, check the LICENSE file for more info.

Author

Alexander Murphy – 🐦@thexande

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

About

🔒 A swift µ framework for secret string constant obfuscation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published