Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.0.1</string>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
6 changes: 3 additions & 3 deletions Source/TPObfuscatedString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ public extension String {

}

private func UC(value: Int) -> String {
return String(Character(UnicodeScalar(value)))
}
private func UC(_ value: Int) -> String {
return String(Character(UnicodeScalar(value)!))
}
10 changes: 5 additions & 5 deletions Source/TPObfuscatedStringConverter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class TPObfuscatedStringConverter {
let characters = phrase.characters
var result = [String]()

let formatter = NSNumberFormatter()
formatter.numberStyle = NSNumberFormatterStyle.SpellOutStyle
let formatter = NumberFormatter()
formatter.numberStyle = NumberFormatter.Style.spellOut

for c in characters {
let s = String(c).unicodeScalars
Expand All @@ -25,7 +25,7 @@ class TPObfuscatedStringConverter {
result.append(String(c))
break
case 48...57:
result.append(formatter.stringFromNumber(Int(String(c))!)!)
result.append(formatter.string(from: NSNumber(value: Int(String(c))!))!)
break
case 32:
result.append("space")
Expand Down Expand Up @@ -131,8 +131,8 @@ class TPObfuscatedStringConverter {
break
}
}
return result.joinWithSeparator(".")
return result.joined(separator: ".")
}


}
}
2 changes: 1 addition & 1 deletion TPObfuscatedString.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "TPObfuscatedString"
s.version = "0.0.2"
s.version = "1.0.0"
s.license = "MIT"
s.summary = "Simple and basic string obfuscating - based on UAObfuscatedString by Matt Coneybeare"
s.homepage = "https://github.com/Techprimate/TPObfuscatedString"
Expand Down
26 changes: 17 additions & 9 deletions TPObfuscatedString.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,17 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Philip Niedertscheider";
TargetAttributes = {
D4DB29441B8EFE0900E6E8D4 = {
CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0800;
ProvisioningStyle = Manual;
};
D4DB296E1B8F017D00E6E8D4 = {
CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -269,8 +272,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand Down Expand Up @@ -318,8 +323,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
Expand All @@ -339,6 +346,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -350,7 +358,9 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -361,14 +371,17 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
D4DB295D1B8EFE0900E6E8D4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand All @@ -378,16 +391,13 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.niedertscheider.philip.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
};
name = Release;
};
D4DB29791B8F017D00E6E8D4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -396,20 +406,18 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.niedertscheider.philip.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
D4DB297A1B8F017D00E6E8D4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
INFOPLIST_FILE = TPObfuscatedStringTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.niedertscheider.philip.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
14 changes: 7 additions & 7 deletions TPObfuscatedStringTests/TPObfuscatedStringTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class TPObfuscatedStringTests: XCTestCase {
// randomString = randomStringWithLength(100)
randomString = "https://192.168.0.67"
print(TPObStr.T.h.i.s.space.i.s.space.a.n.space.e.x.a.m.p.l.e.space.t.e.x.t.colon.space.H.i.exclamation)
method = TPObfuscatedStringConverter.convert(randomString)
method = TPObfuscatedStringConverter.convert(phrase: randomString)
}

override func tearDown() {
Expand All @@ -31,18 +31,18 @@ class TPObfuscatedStringTests: XCTestCase {
func testExample() {
print("Random string to test: \n" + randomString + "\n")
print("Corresponding TPObfuscatedMethodCall:\n" + method + "\n")
let result = callMethod(method)
let result = callMethod(method: method)
print("Result of method call: \n" + result + "\n")
XCTAssert(result == randomString, "Pass")
}

func testPerformanceString() {
measureBlock { () -> Void in
measure { () -> Void in
var _ = "z{OpsNY^3xo\"-WO[k<t ',@I4A]P>+0NGlXX&k()\t=&[#:th:t.Wb.Ow&dQ=\"aoi@s>N2_J<n1vt/i(vDeaKmX1Tj[[mx3-; N|"
}
}
func testPerformanceObfuscatedString() {
self.measureBlock() {
self.measure() {
var _ = TPObStr.z.curlyopenbracket.O.p.s.N.Y.circumflex.three.x.o.quote.minus.W.O.openbracket.k.lessthan.t.space.apostrophe.comma.at.I.four.A.closebracket.P.greaterthan.plus.zero.N.G.l.X.X.and.k.openparantheses.closeparantheses.backslash.t.equal.and.openbracket.hash.colon.t.h.colon.t.dot.W.b.dot.O.w.and.d.Q.equal.quote.a.o.i.at.s.greaterthan.N.two.underscore.J.lessthan.n.one.v.t.slash.i.openparantheses.v.D.e.a.K.m.X.one.T.j.openbracket.openbracket.m.x.three.minus.semicolon.space.N.pipe
}
}
Expand All @@ -54,13 +54,13 @@ func randomStringWithLength (len : Int) -> String {
var result = ""
for _ in 0..<len {
let num = Int(arc4random_uniform(UInt32(max - min))) + min
result += String(Character(UnicodeScalar(num)))
result += String(Character(UnicodeScalar(num)!))
}
return result
}

func callMethod(method: String) -> String {
let methodParts = method.componentsSeparatedByString(".")
let methodParts = method.components(separatedBy: ".")
var result = TPObStr
for call in methodParts {
if call == "zero" {
Expand Down Expand Up @@ -350,4 +350,4 @@ func callMethod(method: String) -> String {
}
}
return result
}
}