Skip to content

Instantly share code, notes, and snippets.

View AnnieNinaJoyceV's full-sized avatar

Joycey ✌️ AnnieNinaJoyceV

View GitHub Profile
- (NSData *)md5DataFromString:(NSString *)input
{
const char *cStr = [input UTF8String];
unsigned char digest[16];
CC_MD5( cStr, (CC_LONG)strlen(cStr), digest ); // This is the md5 call
NSData *data = [NSData dataWithBytes:digest length:CC_MD5_DIGEST_LENGTH];
return data;
}
- (NSString*) doCipher:(NSString*)plainText secretKey:(NSString *)secret operation:(CCOperation)encryptOrDecrypt
@AnnieNinaJoyceV
AnnieNinaJoyceV / Device_JailBroken.swift
Created May 4, 2017 12:35
Function to check whether the device is Jail broken or not
fileprivate func isDeviceJailbroken() -> Bool {
let cydiaPath = "/Applications/Cydia.app" //Cydia is an alternative to Apple's App Store for "jailbroken" devices
if FileManager.default.fileExists(atPath: cydiaPath) {
return true
}
let protectedPath = "/private/jailbreak.test"
do {
try "0".write(toFile: protectedPath, atomically: true, encoding: String.Encoding.utf8)
return true
@AnnieNinaJoyceV
AnnieNinaJoyceV / ODR_ViewController.swift
Created April 29, 2017 06:10
On-Demand Resources - ODR : AppThinning
// Steps to mark ODR resources
// Select file(image, audio, etc) - File inspector - On Demand Resource Tags - Give it a name
class ODR_ViewController: UIViewController {
var tubbyRequest : NSBundleResourceRequest?
@IBOutlet weak var resourceDownloadProgress: UIProgressView! //to show download progress
// fileName is the name of the file's ODR tag
// if you want to download more than 1 file, change String to [String]
func fetchODRResourceWithName(fileName: String) {//to be called when the file needs to be accessed