// // XSUtils.h // XenonSDK // // Created by SAGESSE on 2019/5/28. // Copyright © 2019 SAGESSE. All rights reserved. // #import id sdk_md5(id value); id sdk_signature(id value, id key); id sdk_encrypt(id value, id key); id sdk_decrypt(id value, id key); BOOL sdk_verifyPhone(id value); FOUNDATION_STATIC_INLINE CGFloat CGFloatBasedI375(CGFloat value) { return trunc(value * (UIScreen.mainScreen.nativeBounds.size.width / UIScreen.mainScreen.nativeScale / 375) * UIScreen.mainScreen.scale) / UIScreen.mainScreen.scale; } FOUNDATION_STATIC_INLINE CGFloat CGFloatBasedI414(CGFloat value) { return trunc(value * (UIScreen.mainScreen.nativeBounds.size.width / UIScreen.mainScreen.nativeScale / 414) * UIScreen.mainScreen.scale) / UIScreen.mainScreen.scale; } FOUNDATION_STATIC_INLINE id fqsd(id s) { NSData* d = [[NSData alloc] initWithBase64EncodedString:s options:0]; NSUInteger len = d.length - 1 - 4; if (len == 0) { return s; } uint32_t o = 0; char* source = (void*)d.bytes; // utf8-ptr char* destination = malloc(len + 1); // output memcpy(&o, source, 4); char offset = o % 256; // 0-255 for (int i = 0; i < len; ++i) { destination[i] = source[4 + (i + o) % len] + offset--; } destination[len] = 0; id result = [NSString stringWithUTF8String:destination]; free(destination); return result; }