Compare commits
281 Commits
Author | SHA1 | Date |
---|---|---|
![]() |
0086c768d5 | |
![]() |
b88fb1981f | |
![]() |
9c2497df1e | |
![]() |
7b9a626cd9 | |
![]() |
bcab1fca16 | |
![]() |
51e01158a9 | |
![]() |
401debd079 | |
![]() |
bc0858f8b3 | |
![]() |
fb47728c0f | |
![]() |
58cf3410eb | |
![]() |
b8c954ef74 | |
![]() |
efc2d67c9e | |
![]() |
a8107517be | |
![]() |
a33e668667 | |
![]() |
5a4892f265 | |
![]() |
e7197254ff | |
![]() |
8074ddcd3d | |
![]() |
5765ce10c2 | |
![]() |
0c0f0da5b9 | |
![]() |
420eeb9c69 | |
![]() |
50216dc451 | |
![]() |
b8c108e822 | |
![]() |
36a68052bd | |
![]() |
f1c4ef9216 | |
![]() |
f6b9d8f735 | |
![]() |
5e75addb62 | |
![]() |
ae3aff1f76 | |
![]() |
9b81684542 | |
![]() |
5407f6d03b | |
![]() |
c4bf094d57 | |
![]() |
f62a3ed49c | |
![]() |
1253f6ee58 | |
![]() |
025eaaf283 | |
![]() |
e2def57366 | |
![]() |
0d4761160d | |
![]() |
1b91647f20 | |
![]() |
c04800d1bf | |
![]() |
28939ffbf2 | |
![]() |
bd514a6979 | |
![]() |
072e532285 | |
![]() |
35520266d2 | |
![]() |
a87499dd6f | |
![]() |
8a344222dc | |
![]() |
c6542fe796 | |
![]() |
180da50636 | |
![]() |
a573e193e0 | |
![]() |
52ac2ce19a | |
![]() |
de60d19492 | |
![]() |
a23ea2cf42 | |
![]() |
eea2668a6a | |
![]() |
7381b50aab | |
![]() |
b99bcf27f1 | |
![]() |
1bcaf2377c | |
![]() |
660026d209 | |
![]() |
5a1261f573 | |
![]() |
6032739399 | |
![]() |
98d4b71bff | |
![]() |
ebbf424711 | |
![]() |
00e60a9fa8 | |
![]() |
50d24741cd | |
![]() |
ffffcd74f9 | |
![]() |
7a2f408762 | |
![]() |
c28ab57d02 | |
![]() |
59c8dbb2f1 | |
![]() |
5889ce77f8 | |
![]() |
89e78270ec | |
![]() |
f390ecdf43 | |
![]() |
20a8eba1cc | |
![]() |
a457beaed5 | |
![]() |
23cc42e674 | |
![]() |
fddf68e529 | |
![]() |
bd2fb88adb | |
![]() |
fa3c7aa87a | |
![]() |
d7cc52db68 | |
![]() |
5ad167e1df | |
![]() |
bb5952a08c | |
![]() |
6470634dde | |
![]() |
95f2b2b66f | |
![]() |
0bdaad77e9 | |
![]() |
6bd90056e8 | |
![]() |
3f42b555d0 | |
![]() |
5779390a7e | |
![]() |
d0eb446ee3 | |
![]() |
cda7853b85 | |
![]() |
ca996ebadc | |
![]() |
505b4f37d3 | |
![]() |
bb9c69bdcc | |
![]() |
b988545b11 | |
![]() |
74176a5411 | |
![]() |
8e77e8bee0 | |
![]() |
f240a43c7c | |
![]() |
75af8fb28a | |
![]() |
dd727fc66d | |
![]() |
a33ba07dcb | |
![]() |
62067f8dca | |
![]() |
09d7b35d27 | |
![]() |
8195235436 | |
![]() |
9b9ff8ea7c | |
![]() |
5cc7b4ed1b | |
![]() |
29e8c3cf19 | |
![]() |
3a72eb8280 | |
![]() |
5410f2d45a | |
![]() |
4defc00669 | |
![]() |
d2f8bb11a2 | |
![]() |
981d439d2c | |
![]() |
87495d5b9a | |
![]() |
e6840407b9 | |
![]() |
397d52e5f0 | |
![]() |
8e103393a3 | |
![]() |
96c08e1695 | |
![]() |
0a71123b7d | |
![]() |
02e910bd0d | |
![]() |
3c9b2b3440 | |
![]() |
a8b04db79d | |
![]() |
7a12e10419 | |
![]() |
261051b22a | |
![]() |
d8c68394f9 | |
![]() |
b1c6a23be4 | |
![]() |
fddfcd8098 | |
![]() |
1f039c1fc8 | |
![]() |
2a6a12b0b8 | |
![]() |
bb1ee29558 | |
![]() |
c461ba36dd | |
![]() |
db4eb93761 | |
![]() |
defca88ceb | |
![]() |
721df40f44 | |
![]() |
180f9d5093 | |
![]() |
bd9f5d3267 | |
![]() |
631c3dbc2a | |
![]() |
4e14ee1019 | |
![]() |
3b7a71c443 | |
![]() |
976040681c | |
![]() |
b56fa80ee2 | |
![]() |
7e2182efd4 | |
![]() |
e226125df9 | |
![]() |
349543d8c4 | |
![]() |
8ce72689f7 | |
![]() |
b55932643f | |
![]() |
a430813649 | |
![]() |
fc68e1ec17 | |
![]() |
c2064f528a | |
![]() |
63c0bc3282 | |
![]() |
cb1632e02e | |
![]() |
496ac26a8a | |
![]() |
5dba30f4ca | |
![]() |
e45d067c97 | |
![]() |
7f871d94e5 | |
![]() |
68d29e83dd | |
![]() |
7ddcb42213 | |
![]() |
8a01ee69dc | |
![]() |
93cdb99544 | |
![]() |
219bae7d33 | |
![]() |
d0cd978442 | |
![]() |
3b11d10c86 | |
![]() |
17b50b081c | |
![]() |
2e213dde01 | |
![]() |
a8c63990a8 | |
![]() |
73758d205f | |
![]() |
4f624d422a | |
![]() |
5ee24d1999 | |
![]() |
5f9f9414f0 | |
![]() |
a3433a46e1 | |
![]() |
a13da23824 | |
![]() |
308f82219e | |
![]() |
35d442f403 | |
![]() |
18fd81075d | |
![]() |
99f1d88884 | |
![]() |
26f672a875 | |
![]() |
ade3622a5b | |
![]() |
591727bac6 | |
![]() |
59b8ba0867 | |
![]() |
c1252be171 | |
![]() |
705fca2c53 | |
![]() |
f52cf31f35 | |
![]() |
0d2c4ff96d | |
![]() |
5283a5f780 | |
![]() |
45972c1178 | |
![]() |
6b68077258 | |
![]() |
da9484893a | |
![]() |
f876aaddbd | |
![]() |
c897320b4a | |
![]() |
c44f4b6b3e | |
![]() |
cef2d74942 | |
![]() |
b13041a65a | |
![]() |
12ae600617 | |
![]() |
5ebcf4bb76 | |
![]() |
515fcc22fb | |
![]() |
c7554987a8 | |
![]() |
5fbd068d0b | |
![]() |
357e3a21c4 | |
![]() |
9f30b01488 | |
![]() |
a076c8c8d2 | |
![]() |
2cb85a9e4e | |
![]() |
13bbf80d3e | |
![]() |
2b25ae6b11 | |
![]() |
d28596dff2 | |
![]() |
62abeb9339 | |
![]() |
85a8b7e515 | |
![]() |
0de212ac42 | |
![]() |
3c710fc04d | |
![]() |
81ff8633cb | |
![]() |
b163bf134b | |
![]() |
7f2a2abb07 | |
![]() |
3322e6e800 | |
![]() |
b65410cd51 | |
![]() |
38f73840a4 | |
![]() |
eac167a02a | |
![]() |
06a1c0d10e | |
![]() |
b8bf3e7ccc | |
![]() |
cead592fde | |
![]() |
873ec08cbf | |
![]() |
a061fc0b24 | |
![]() |
05b2998eda | |
![]() |
f7b0707c4d | |
![]() |
623835cd92 | |
![]() |
b5180d04cd | |
![]() |
306d52e473 | |
![]() |
bcac09b68d | |
![]() |
cf5ede8e81 | |
![]() |
4eb5ce7171 | |
![]() |
fc5d3b1a9d | |
![]() |
d01e44e473 | |
![]() |
6704b0bb35 | |
![]() |
f6a63b583a | |
![]() |
2976fbaa72 | |
![]() |
1aaee4bcef | |
![]() |
eea632e8b2 | |
![]() |
9a7c72af34 | |
![]() |
b7bfb5754e | |
![]() |
25895d9a4d | |
![]() |
f9218c6ef9 | |
![]() |
85a1e8b9bf | |
![]() |
889cf28bb0 | |
![]() |
fdcbbe5ff4 | |
![]() |
4af340aa54 | |
![]() |
bc0cec5cf9 | |
![]() |
9702158027 | |
![]() |
fbb7c9234e | |
![]() |
5a09916af4 | |
![]() |
65245580fa | |
![]() |
c7e7d7b3d5 | |
![]() |
24a45c2e52 | |
![]() |
e8cc3d58fa | |
![]() |
56389ac4c4 | |
![]() |
6cf15a201c | |
![]() |
02688f4ea8 | |
![]() |
070b8fd685 | |
![]() |
a1256d12b3 | |
![]() |
3a626d0b98 | |
![]() |
1dcf4dc239 | |
![]() |
d2525c1660 | |
![]() |
4b0bb7e657 | |
![]() |
54b51e0b60 | |
![]() |
45da43bd2b | |
![]() |
f7d6dc4bc6 | |
![]() |
75ac27cd6b | |
![]() |
535fb94c46 | |
![]() |
d21b54001b | |
![]() |
89c4410a66 | |
![]() |
a9444562ec | |
![]() |
27f61b0f8e | |
![]() |
fcc11f61cb | |
![]() |
bbf8d0267c | |
![]() |
35a636968c | |
![]() |
0701a4f7a3 | |
![]() |
59bf509f97 | |
![]() |
e2097fff3d | |
![]() |
b894b8ebed | |
![]() |
ad842f3033 | |
![]() |
673d5ebe83 | |
![]() |
0b1a673478 | |
![]() |
56a062b38d | |
![]() |
2a5b4df5ba | |
![]() |
14a4c4aa67 | |
![]() |
d1bab3136c | |
![]() |
4969c99684 | |
![]() |
065857c614 | |
![]() |
f8e1cb4d82 | |
![]() |
ef457e31af | |
![]() |
ce8a5599b0 | |
![]() |
990ad0c70d |
|
@ -22,3 +22,8 @@ DerivedData
|
|||
# Bundler
|
||||
.bundle
|
||||
|
||||
Carthage
|
||||
Cartfile.resolved
|
||||
|
||||
# SPM
|
||||
.build/
|
13
.travis.yml
13
.travis.yml
|
@ -1,13 +0,0 @@
|
|||
language: objective-c
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
xcode_project: SwiftDDP.xcodeproj
|
||||
xcode_scheme: SwiftDDP
|
||||
osx_image: xcode7
|
||||
xcode_sdk: iphonesimulator8.4
|
||||
|
||||
script:
|
||||
- xcodebuild clean build test -project SwiftDDP.xcodeproj -scheme SwiftDDP
|
12
Cartfile
12
Cartfile
|
@ -1,9 +1,3 @@
|
|||
|
||||
github "krzyzanowskim/CryptoSwift" "0.0.16"
|
||||
github "tidwall/SwiftWebSocket" "v2.1.1"
|
||||
|
||||
github "DaveWoodCom/XCGLogger" "Version_3.0"
|
||||
|
||||
github "Quick/Quick" "v0.6.0"
|
||||
github "Quick/Nimble" "v2.0.0-rc.3"
|
||||
|
||||
github "krzyzanowskim/CryptoSwift"
|
||||
github "tidwall/SwiftWebSocket"
|
||||
github "DaveWoodCom/XCGLogger"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
github "Quick/Nimble" # Not building with Swift 2.2
|
||||
github "Quick/Quick" # Not building with Swift 2.2
|
|
@ -1,5 +0,0 @@
|
|||
github "krzyzanowskim/CryptoSwift" "0.0.16"
|
||||
github "Quick/Nimble" "v2.0.0-rc.3"
|
||||
github "Quick/Quick" "v0.6.0"
|
||||
github "tidwall/SwiftWebSocket" "v2.1.1"
|
||||
github "DaveWoodCom/XCGLogger" "Version_3.0"
|
|
@ -1,18 +0,0 @@
|
|||
### Xcode ###
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.xcuserstate
|
||||
timeline.xctimeline
|
||||
|
||||
/Framework
|
|
@ -1 +0,0 @@
|
|||
../../../../Carthage/Build
|
|
@ -1,17 +0,0 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "CryptoSwift"
|
||||
s.version = "0.0.16"
|
||||
s.summary = "Cryptography in Swift. SHA, MD5, CRC, Poly1305, HMAC, ChaCha20, AES."
|
||||
s.description = "Cryptography functions and helpers for Swift implemented in Swift. SHA, MD5, CRC, Poly1305, HMAC, ChaCha20, AES."
|
||||
s.homepage = "https://github.com/krzyzanowskim/CryptoSwift"
|
||||
s.license = {:type => "Attribution License", :file => "LICENSE"}
|
||||
s.source = { :git => "https://github.com/krzyzanowskim/CryptoSwift.git", :tag => "#{s.version}" }
|
||||
s.authors = {'Marcin Krzyżanowski' => 'marcin.krzyzanowski@hakore.com'}
|
||||
s.social_media_url = "https://twitter.com/krzyzanowskim"
|
||||
s.ios.platform = :ios, '8.0'
|
||||
s.ios.deployment_target = "8.0"
|
||||
s.osx.platform = :osx, '10.9'
|
||||
s.osx.deployment_target = "10.9"
|
||||
s.source_files = "CryptoSwift/*.swift"
|
||||
s.requires_arc = true
|
||||
end
|
|
@ -1,765 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
3F8849E11B0647D6006AB604 /* CryptoSwift-Universal */ = {
|
||||
isa = PBXAggregateTarget;
|
||||
buildConfigurationList = 3F8849E21B0647D6006AB604 /* Build configuration list for PBXAggregateTarget "CryptoSwift-Universal" */;
|
||||
buildPhases = (
|
||||
3F8849E51B0647DD006AB604 /* ShellScript */,
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "CryptoSwift-Universal";
|
||||
productName = "CryptoSwift-Universal";
|
||||
};
|
||||
/* End PBXAggregateTarget section */
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
75100F8F19B0BC890005C5F5 /* Poly1305Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75100F8E19B0BC890005C5F5 /* Poly1305Tests.swift */; };
|
||||
75164E4919AD30AC00737F30 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75164E4819AD30AC00737F30 /* Utils.swift */; };
|
||||
751C5C3D19B26B000094C75D /* Poly1305.swift in Sources */ = {isa = PBXBuildFile; fileRef = 751C5C3C19B26B000094C75D /* Poly1305.swift */; };
|
||||
7539E3291B3B4A530037F4E1 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 750A545F1992D2680017DA75 /* MD5.swift */; };
|
||||
7539E32A1B3B4C480037F4E1 /* NSDataExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752DEF7619693EA000E17557 /* NSDataExtension.swift */; };
|
||||
7539E32B1B3B4C6B0037F4E1 /* HMAC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 758A94251A65AEB100E46135 /* HMAC.swift */; };
|
||||
7539E32C1B3B4C750037F4E1 /* StringExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7599C9C5199EA28700A3988B /* StringExtension.swift */; };
|
||||
7539E32D1B3B4E950037F4E1 /* SHA1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752E087A199FF27C005B0EA0 /* SHA1.swift */; };
|
||||
7539E32E1B3B4E970037F4E1 /* SHA2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75153D4119AA3C7900750381 /* SHA2.swift */; };
|
||||
75445821196AA2A5002FF20E /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75445820196AA2A5002FF20E /* Security.framework */; settings = {ATTRIBUTES = (Required, ); }; };
|
||||
7547195119931802002FA5F1 /* IntExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7547195019931802002FA5F1 /* IntExtension.swift */; };
|
||||
754BE45B19693E190098E6F3 /* CryptoSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 754BE45A19693E190098E6F3 /* CryptoSwift.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
754BE46819693E190098E6F3 /* HashTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754BE46719693E190098E6F3 /* HashTests.swift */; };
|
||||
754C30B71AA13BC000E6FFA4 /* PKCS7.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754C30B61AA13BC000E6FFA4 /* PKCS7.swift */; };
|
||||
754C8FED19979F94005AD904 /* ArrayExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754C8FEC19979F94005AD904 /* ArrayExtension.swift */; };
|
||||
754DD76E19A149AF00E52288 /* HashProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 754DD76D19A149AF00E52288 /* HashProtocol.swift */; };
|
||||
755111E819B7B7DF00C2AD86 /* Authenticator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755111E719B7B7DF00C2AD86 /* Authenticator.swift */; };
|
||||
7552614E1993051E000D2B20 /* Hash.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7552614D1993051E000D2B20 /* Hash.swift */; };
|
||||
755FB1DA199E347D00475437 /* ExtensionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 755FB1D9199E347D00475437 /* ExtensionsTest.swift */; };
|
||||
7563B2E819B14D4300B152CD /* Cipher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7563B2E719B14D4300B152CD /* Cipher.swift */; };
|
||||
757DA2531A4ED0A4002BA3EF /* PaddingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757DA2521A4ED0A4002BA3EF /* PaddingTests.swift */; };
|
||||
757DA2551A4ED408002BA3EF /* AESTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757DA2541A4ED408002BA3EF /* AESTests.swift */; };
|
||||
757DA2571A4ED47B002BA3EF /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757DA2561A4ED47B002BA3EF /* Helpers.swift */; };
|
||||
757DA2591A4ED4D7002BA3EF /* ChaCha20Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757DA2581A4ED4D7002BA3EF /* ChaCha20Tests.swift */; };
|
||||
757EF7F519AAA82400586276 /* CRC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 757EF7F419AAA82400586276 /* CRC.swift */; };
|
||||
758A94281A65C59200E46135 /* HMACTests.swift in Resources */ = {isa = PBXBuildFile; fileRef = 758A94271A65C59200E46135 /* HMACTests.swift */; };
|
||||
758A94291A65C67400E46135 /* HMACTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 758A94271A65C59200E46135 /* HMACTests.swift */; };
|
||||
758C764119B61AE500653BC6 /* Generics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 758C764019B61AE500653BC6 /* Generics.swift */; };
|
||||
758C764319B61DE900653BC6 /* UInt16Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 758C764219B61DE900653BC6 /* UInt16Extension.swift */; };
|
||||
758F3F781992F6CE0014BBDA /* UInt8Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 758F3F771992F6CE0014BBDA /* UInt8Extension.swift */; };
|
||||
759D481119B517BC005FF7FC /* BitExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759D481019B517BC005FF7FC /* BitExtension.swift */; };
|
||||
75A663A61AA0CAD00052110B /* Padding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75A663A51AA0CAD00052110B /* Padding.swift */; };
|
||||
75A74B271A1FF6B2004419F1 /* AES.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75A74B261A1FF6B2004419F1 /* AES.swift */; };
|
||||
75B0A5701AB1A1BB000BD8D2 /* PKCS5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B0A56F1AB1A1BB000BD8D2 /* PKCS5.swift */; };
|
||||
75B601EB197D6A6C0009B53D /* CryptoSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 754BE45519693E190098E6F3 /* CryptoSwift.framework */; };
|
||||
75BC3AE31A4E412000ADF343 /* CipherBlockMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BC3AE21A4E412000ADF343 /* CipherBlockMode.swift */; };
|
||||
75BE4EB11B1E4A9F007A2B57 /* IntegerConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BE4EB01B1E4A9F007A2B57 /* IntegerConvertible.swift */; };
|
||||
75D2D1A01B5689EB000A2615 /* NSDataSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D2D19F1B5689EB000A2615 /* NSDataSequence.swift */; };
|
||||
75D94E2419B60C08007CB2A4 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D94E2319B60C08007CB2A4 /* Operators.swift */; };
|
||||
75D94E2619B60C4F007CB2A4 /* UInt32Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D94E2519B60C4F007CB2A4 /* UInt32Extension.swift */; };
|
||||
75D94E2819B60DDE007CB2A4 /* UInt64Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75D94E2719B60DDE007CB2A4 /* UInt64Extension.swift */; };
|
||||
75EB380119ABDD710002375A /* ChaCha20.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EB380019ABDD710002375A /* ChaCha20.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
75B601E3197D69EB0009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B601E5197D6A270009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B601E7197D6A3A0009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B601E9197D6A5C0009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B601EC197D6B3D0009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B6021C197D6CF10009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
75B6021E197D6D070009B53D /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 754BE45419693E190098E6F3;
|
||||
remoteInfo = CryptoSwift;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
75B601E0197D69770009B53D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
750A545F1992D2680017DA75 /* MD5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MD5.swift; sourceTree = "<group>"; };
|
||||
75100F8E19B0BC890005C5F5 /* Poly1305Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Poly1305Tests.swift; sourceTree = "<group>"; };
|
||||
75153D4119AA3C7900750381 /* SHA2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHA2.swift; sourceTree = "<group>"; };
|
||||
75164E4819AD30AC00737F30 /* Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
|
||||
751C5C3C19B26B000094C75D /* Poly1305.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Poly1305.swift; sourceTree = "<group>"; };
|
||||
752DEF7619693EA000E17557 /* NSDataExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDataExtension.swift; sourceTree = "<group>"; };
|
||||
752E087A199FF27C005B0EA0 /* SHA1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHA1.swift; sourceTree = "<group>"; };
|
||||
75445820196AA2A5002FF20E /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
|
||||
7547195019931802002FA5F1 /* IntExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntExtension.swift; sourceTree = "<group>"; };
|
||||
754BE45519693E190098E6F3 /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
754BE45919693E190098E6F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
754BE45A19693E190098E6F3 /* CryptoSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CryptoSwift.h; sourceTree = "<group>"; };
|
||||
754BE46019693E190098E6F3 /* CryptoSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CryptoSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
754BE46619693E190098E6F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
754BE46719693E190098E6F3 /* HashTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashTests.swift; sourceTree = "<group>"; };
|
||||
754C30B61AA13BC000E6FFA4 /* PKCS7.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKCS7.swift; sourceTree = "<group>"; };
|
||||
754C8FEC19979F94005AD904 /* ArrayExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArrayExtension.swift; sourceTree = "<group>"; };
|
||||
754DD76D19A149AF00E52288 /* HashProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashProtocol.swift; sourceTree = "<group>"; };
|
||||
755111E719B7B7DF00C2AD86 /* Authenticator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Authenticator.swift; sourceTree = "<group>"; };
|
||||
7552614D1993051E000D2B20 /* Hash.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Hash.swift; sourceTree = "<group>"; };
|
||||
755FB1D9199E347D00475437 /* ExtensionsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionsTest.swift; sourceTree = "<group>"; };
|
||||
7563B2E719B14D4300B152CD /* Cipher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Cipher.swift; sourceTree = "<group>"; };
|
||||
756BFDCA1A82B87300B9D9A4 /* Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bridging.h; sourceTree = "<group>"; };
|
||||
757DA2521A4ED0A4002BA3EF /* PaddingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PaddingTests.swift; sourceTree = "<group>"; };
|
||||
757DA2541A4ED408002BA3EF /* AESTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AESTests.swift; sourceTree = "<group>"; };
|
||||
757DA2561A4ED47B002BA3EF /* Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = "<group>"; };
|
||||
757DA2581A4ED4D7002BA3EF /* ChaCha20Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChaCha20Tests.swift; sourceTree = "<group>"; };
|
||||
757EF7F419AAA82400586276 /* CRC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRC.swift; sourceTree = "<group>"; };
|
||||
758A94251A65AEB100E46135 /* HMAC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMAC.swift; sourceTree = "<group>"; };
|
||||
758A94271A65C59200E46135 /* HMACTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMACTests.swift; sourceTree = "<group>"; };
|
||||
758C764019B61AE500653BC6 /* Generics.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Generics.swift; sourceTree = "<group>"; };
|
||||
758C764219B61DE900653BC6 /* UInt16Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt16Extension.swift; sourceTree = "<group>"; };
|
||||
758F3F771992F6CE0014BBDA /* UInt8Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt8Extension.swift; sourceTree = "<group>"; };
|
||||
7599C9C5199EA28700A3988B /* StringExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringExtension.swift; sourceTree = "<group>"; };
|
||||
759D481019B517BC005FF7FC /* BitExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BitExtension.swift; sourceTree = "<group>"; };
|
||||
75A663A51AA0CAD00052110B /* Padding.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Padding.swift; sourceTree = "<group>"; };
|
||||
75A74B261A1FF6B2004419F1 /* AES.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AES.swift; sourceTree = "<group>"; };
|
||||
75B0A56F1AB1A1BB000BD8D2 /* PKCS5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKCS5.swift; sourceTree = "<group>"; };
|
||||
75BC3AE21A4E412000ADF343 /* CipherBlockMode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CipherBlockMode.swift; sourceTree = "<group>"; };
|
||||
75BE4EB01B1E4A9F007A2B57 /* IntegerConvertible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntegerConvertible.swift; sourceTree = "<group>"; };
|
||||
75D2D19F1B5689EB000A2615 /* NSDataSequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSDataSequence.swift; sourceTree = "<group>"; };
|
||||
75D94E2319B60C08007CB2A4 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
|
||||
75D94E2519B60C4F007CB2A4 /* UInt32Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt32Extension.swift; sourceTree = "<group>"; };
|
||||
75D94E2719B60DDE007CB2A4 /* UInt64Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt64Extension.swift; sourceTree = "<group>"; };
|
||||
75EB380019ABDD710002375A /* ChaCha20.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChaCha20.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
754BE45119693E190098E6F3 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
75445821196AA2A5002FF20E /* Security.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
754BE45D19693E190098E6F3 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
75B601EB197D6A6C0009B53D /* CryptoSwift.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
24B0BBA29D734E62809E53BC /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
75445820196AA2A5002FF20E /* Security.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE44B19693E190098E6F3 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
754BE45719693E190098E6F3 /* CryptoSwift */,
|
||||
754BE46419693E190098E6F3 /* CryptoSwiftTests */,
|
||||
754BE45619693E190098E6F3 /* Products */,
|
||||
24B0BBA29D734E62809E53BC /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE45619693E190098E6F3 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
754BE45519693E190098E6F3 /* CryptoSwift.framework */,
|
||||
754BE46019693E190098E6F3 /* CryptoSwiftTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE45719693E190098E6F3 /* CryptoSwift */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
754BE45A19693E190098E6F3 /* CryptoSwift.h */,
|
||||
7552614D1993051E000D2B20 /* Hash.swift */,
|
||||
7563B2E719B14D4300B152CD /* Cipher.swift */,
|
||||
75BC3AE21A4E412000ADF343 /* CipherBlockMode.swift */,
|
||||
75A663A51AA0CAD00052110B /* Padding.swift */,
|
||||
75B0A56F1AB1A1BB000BD8D2 /* PKCS5.swift */,
|
||||
754C30B61AA13BC000E6FFA4 /* PKCS7.swift */,
|
||||
755111E719B7B7DF00C2AD86 /* Authenticator.swift */,
|
||||
754DD76D19A149AF00E52288 /* HashProtocol.swift */,
|
||||
750A545F1992D2680017DA75 /* MD5.swift */,
|
||||
752E087A199FF27C005B0EA0 /* SHA1.swift */,
|
||||
75153D4119AA3C7900750381 /* SHA2.swift */,
|
||||
757EF7F419AAA82400586276 /* CRC.swift */,
|
||||
75EB380019ABDD710002375A /* ChaCha20.swift */,
|
||||
751C5C3C19B26B000094C75D /* Poly1305.swift */,
|
||||
758A94251A65AEB100E46135 /* HMAC.swift */,
|
||||
75A74B261A1FF6B2004419F1 /* AES.swift */,
|
||||
759D481019B517BC005FF7FC /* BitExtension.swift */,
|
||||
758F3F771992F6CE0014BBDA /* UInt8Extension.swift */,
|
||||
7547195019931802002FA5F1 /* IntExtension.swift */,
|
||||
758C764219B61DE900653BC6 /* UInt16Extension.swift */,
|
||||
75D94E2519B60C4F007CB2A4 /* UInt32Extension.swift */,
|
||||
75D94E2719B60DDE007CB2A4 /* UInt64Extension.swift */,
|
||||
752DEF7619693EA000E17557 /* NSDataExtension.swift */,
|
||||
754C8FEC19979F94005AD904 /* ArrayExtension.swift */,
|
||||
7599C9C5199EA28700A3988B /* StringExtension.swift */,
|
||||
75D94E2319B60C08007CB2A4 /* Operators.swift */,
|
||||
75164E4819AD30AC00737F30 /* Utils.swift */,
|
||||
758C764019B61AE500653BC6 /* Generics.swift */,
|
||||
75BE4EB01B1E4A9F007A2B57 /* IntegerConvertible.swift */,
|
||||
75D2D19F1B5689EB000A2615 /* NSDataSequence.swift */,
|
||||
754BE45819693E190098E6F3 /* Supporting Files */,
|
||||
);
|
||||
path = CryptoSwift;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE45819693E190098E6F3 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
754BE45919693E190098E6F3 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE46419693E190098E6F3 /* CryptoSwiftTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
757DA2561A4ED47B002BA3EF /* Helpers.swift */,
|
||||
754BE46719693E190098E6F3 /* HashTests.swift */,
|
||||
75100F8E19B0BC890005C5F5 /* Poly1305Tests.swift */,
|
||||
758A94271A65C59200E46135 /* HMACTests.swift */,
|
||||
757DA2541A4ED408002BA3EF /* AESTests.swift */,
|
||||
757DA2581A4ED4D7002BA3EF /* ChaCha20Tests.swift */,
|
||||
755FB1D9199E347D00475437 /* ExtensionsTest.swift */,
|
||||
757DA2521A4ED0A4002BA3EF /* PaddingTests.swift */,
|
||||
756BFDCA1A82B87300B9D9A4 /* Bridging.h */,
|
||||
754BE46519693E190098E6F3 /* Supporting Files */,
|
||||
);
|
||||
path = CryptoSwiftTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
754BE46519693E190098E6F3 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
754BE46619693E190098E6F3 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
754BE45219693E190098E6F3 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
754BE45B19693E190098E6F3 /* CryptoSwift.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
754BE45419693E190098E6F3 /* CryptoSwift */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 754BE46B19693E190098E6F3 /* Build configuration list for PBXNativeTarget "CryptoSwift" */;
|
||||
buildPhases = (
|
||||
754BE45019693E190098E6F3 /* Sources */,
|
||||
754BE45119693E190098E6F3 /* Frameworks */,
|
||||
754BE45219693E190098E6F3 /* Headers */,
|
||||
754BE45319693E190098E6F3 /* Resources */,
|
||||
75B601E0197D69770009B53D /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CryptoSwift;
|
||||
productName = CryptoSwift;
|
||||
productReference = 754BE45519693E190098E6F3 /* CryptoSwift.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
754BE45F19693E190098E6F3 /* CryptoSwiftTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 754BE46E19693E190098E6F3 /* Build configuration list for PBXNativeTarget "CryptoSwiftTests" */;
|
||||
buildPhases = (
|
||||
754BE45C19693E190098E6F3 /* Sources */,
|
||||
754BE45D19693E190098E6F3 /* Frameworks */,
|
||||
754BE45E19693E190098E6F3 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
75B601E4197D69EB0009B53D /* PBXTargetDependency */,
|
||||
75B601E6197D6A270009B53D /* PBXTargetDependency */,
|
||||
75B601E8197D6A3A0009B53D /* PBXTargetDependency */,
|
||||
75B601EA197D6A5C0009B53D /* PBXTargetDependency */,
|
||||
75B601ED197D6B3D0009B53D /* PBXTargetDependency */,
|
||||
75B6021D197D6CF10009B53D /* PBXTargetDependency */,
|
||||
75B6021F197D6D070009B53D /* PBXTargetDependency */,
|
||||
);
|
||||
name = CryptoSwiftTests;
|
||||
productName = CryptoSwiftTests;
|
||||
productReference = 754BE46019693E190098E6F3 /* CryptoSwiftTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
754BE44C19693E190098E6F3 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Marcin Krzyzanowski";
|
||||
TargetAttributes = {
|
||||
3F8849E11B0647D6006AB604 = {
|
||||
CreatedOnToolsVersion = 6.3.1;
|
||||
};
|
||||
754BE45419693E190098E6F3 = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
};
|
||||
754BE45F19693E190098E6F3 = {
|
||||
CreatedOnToolsVersion = 6.0;
|
||||
TestTargetID = 754BE45419693E190098E6F3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 754BE44F19693E190098E6F3 /* Build configuration list for PBXProject "CryptoSwift" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 754BE44B19693E190098E6F3;
|
||||
productRefGroup = 754BE45619693E190098E6F3 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
754BE45419693E190098E6F3 /* CryptoSwift */,
|
||||
754BE45F19693E190098E6F3 /* CryptoSwiftTests */,
|
||||
3F8849E11B0647D6006AB604 /* CryptoSwift-Universal */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
754BE45319693E190098E6F3 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
754BE45E19693E190098E6F3 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
758A94281A65C59200E46135 /* HMACTests.swift in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
3F8849E51B0647DD006AB604 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "TARGET_NAME=\"CryptoSwift\"\nFRAMEWORK_NAME=\"CryptoSwift\"\nINSTALL_DIR=\"Framework\"\nFRAMEWORK=\"${INSTALL_DIR}/${FRAMEWORK_NAME}.framework\"\n\nif [ -d \"${INSTALL_DIR}\" ]\nthen\nrm -rf \"${INSTALL_DIR}\"\nfi\n\nmkdir \"${INSTALL_DIR}\"\n\nWRK_DIR=\"build\"\nDEVICE_DIR=\"${WRK_DIR}/Release-iphoneos/${FRAMEWORK_NAME}.framework\"\nSIMULATOR_DIR=\"${WRK_DIR}/Release-iphonesimulator/${FRAMEWORK_NAME}.framework\"\n\nxcodebuild -configuration \"Release\" -target \"${TARGET_NAME}\" -sdk iphoneos SYMROOT=$(PWD)/${WRK_DIR}\nxcodebuild -configuration \"Release\" -target \"${TARGET_NAME}\" -sdk iphonesimulator SYMROOT=$(PWD)/${WRK_DIR}\n\nlipo -create \"${DEVICE_DIR}/${FRAMEWORK_NAME}\" \"${SIMULATOR_DIR}/${FRAMEWORK_NAME}\" -output \"${DEVICE_DIR}/${FRAMEWORK_NAME}\"\n\ncp -R \"${DEVICE_DIR}\" \"${INSTALL_DIR}/\"\n\nif [ -d \"${SIMULATOR_DIR}/Modules/${FRAMEWORK_NAME}.swiftmodule/\" ]; then\ncp -f -R \"${SIMULATOR_DIR}/Modules/${FRAMEWORK_NAME}.swiftmodule/\" \"${FRAMEWORK}/Modules/${FRAMEWORK_NAME}.swiftmodule/\" | echo\nfi\n\nrm -r \"${WRK_DIR}\"";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
754BE45019693E190098E6F3 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
75D2D1A01B5689EB000A2615 /* NSDataSequence.swift in Sources */,
|
||||
75D94E2819B60DDE007CB2A4 /* UInt64Extension.swift in Sources */,
|
||||
751C5C3D19B26B000094C75D /* Poly1305.swift in Sources */,
|
||||
7552614E1993051E000D2B20 /* Hash.swift in Sources */,
|
||||
75BC3AE31A4E412000ADF343 /* CipherBlockMode.swift in Sources */,
|
||||
75BE4EB11B1E4A9F007A2B57 /* IntegerConvertible.swift in Sources */,
|
||||
7539E32E1B3B4E970037F4E1 /* SHA2.swift in Sources */,
|
||||
7539E32C1B3B4C750037F4E1 /* StringExtension.swift in Sources */,
|
||||
7563B2E819B14D4300B152CD /* Cipher.swift in Sources */,
|
||||
7539E32B1B3B4C6B0037F4E1 /* HMAC.swift in Sources */,
|
||||
7539E32A1B3B4C480037F4E1 /* NSDataExtension.swift in Sources */,
|
||||
75EB380119ABDD710002375A /* ChaCha20.swift in Sources */,
|
||||
75A663A61AA0CAD00052110B /* Padding.swift in Sources */,
|
||||
75164E4919AD30AC00737F30 /* Utils.swift in Sources */,
|
||||
759D481119B517BC005FF7FC /* BitExtension.swift in Sources */,
|
||||
754C8FED19979F94005AD904 /* ArrayExtension.swift in Sources */,
|
||||
7539E3291B3B4A530037F4E1 /* MD5.swift in Sources */,
|
||||
7547195119931802002FA5F1 /* IntExtension.swift in Sources */,
|
||||
758C764319B61DE900653BC6 /* UInt16Extension.swift in Sources */,
|
||||
75D94E2419B60C08007CB2A4 /* Operators.swift in Sources */,
|
||||
7539E32D1B3B4E950037F4E1 /* SHA1.swift in Sources */,
|
||||
75B0A5701AB1A1BB000BD8D2 /* PKCS5.swift in Sources */,
|
||||
757EF7F519AAA82400586276 /* CRC.swift in Sources */,
|
||||
75D94E2619B60C4F007CB2A4 /* UInt32Extension.swift in Sources */,
|
||||
75A74B271A1FF6B2004419F1 /* AES.swift in Sources */,
|
||||
754C30B71AA13BC000E6FFA4 /* PKCS7.swift in Sources */,
|
||||
755111E819B7B7DF00C2AD86 /* Authenticator.swift in Sources */,
|
||||
754DD76E19A149AF00E52288 /* HashProtocol.swift in Sources */,
|
||||
758C764119B61AE500653BC6 /* Generics.swift in Sources */,
|
||||
758F3F781992F6CE0014BBDA /* UInt8Extension.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
754BE45C19693E190098E6F3 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
758A94291A65C67400E46135 /* HMACTests.swift in Sources */,
|
||||
75100F8F19B0BC890005C5F5 /* Poly1305Tests.swift in Sources */,
|
||||
757DA2571A4ED47B002BA3EF /* Helpers.swift in Sources */,
|
||||
754BE46819693E190098E6F3 /* HashTests.swift in Sources */,
|
||||
757DA2591A4ED4D7002BA3EF /* ChaCha20Tests.swift in Sources */,
|
||||
755FB1DA199E347D00475437 /* ExtensionsTest.swift in Sources */,
|
||||
757DA2531A4ED0A4002BA3EF /* PaddingTests.swift in Sources */,
|
||||
757DA2551A4ED408002BA3EF /* AESTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
75B601E4197D69EB0009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B601E3197D69EB0009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B601E6197D6A270009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B601E5197D6A270009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B601E8197D6A3A0009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B601E7197D6A3A0009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B601EA197D6A5C0009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B601E9197D6A5C0009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B601ED197D6B3D0009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B601EC197D6B3D0009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B6021D197D6CF10009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B6021C197D6CF10009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
75B6021F197D6D070009B53D /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 754BE45419693E190098E6F3 /* CryptoSwift */;
|
||||
targetProxy = 75B6021E197D6D070009B53D /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3F8849E31B0647D6006AB604 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3F8849E41B0647D6006AB604 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
754BE46919693E190098E6F3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
METAL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
754BE46A19693E190098E6F3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
METAL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
754BE46C19693E190098E6F3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"includes/**",
|
||||
);
|
||||
INFOPLIST_FILE = CryptoSwift/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
754BE46D19693E190098E6F3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_UNROLL_LOOPS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"includes/**",
|
||||
);
|
||||
INFOPLIST_FILE = CryptoSwift/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LLVM_LTO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
754BE46F19693E190098E6F3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"includes/**",
|
||||
);
|
||||
INFOPLIST_FILE = CryptoSwiftTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LLVM_LTO = NO;
|
||||
METAL_ENABLE_DEBUG_INFO = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = CryptoSwiftTests/Bridging.h;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
754BE47019693E190098E6F3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_OPTIMIZATION_LEVEL = fast;
|
||||
GCC_UNROLL_LOOPS = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
|
||||
"includes/**",
|
||||
);
|
||||
INFOPLIST_FILE = CryptoSwiftTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LLVM_LTO = YES;
|
||||
METAL_ENABLE_DEBUG_INFO = NO;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_DISABLE_SAFETY_CHECKS = YES;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = CryptoSwiftTests/Bridging.h;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3F8849E21B0647D6006AB604 /* Build configuration list for PBXAggregateTarget "CryptoSwift-Universal" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3F8849E31B0647D6006AB604 /* Debug */,
|
||||
3F8849E41B0647D6006AB604 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
754BE44F19693E190098E6F3 /* Build configuration list for PBXProject "CryptoSwift" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
754BE46919693E190098E6F3 /* Debug */,
|
||||
754BE46A19693E190098E6F3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
754BE46B19693E190098E6F3 /* Build configuration list for PBXNativeTarget "CryptoSwift" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
754BE46C19693E190098E6F3 /* Debug */,
|
||||
754BE46D19693E190098E6F3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
754BE46E19693E190098E6F3 /* Build configuration list for PBXNativeTarget "CryptoSwiftTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
754BE46F19693E190098E6F3 /* Debug */,
|
||||
754BE47019693E190098E6F3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 754BE44C19693E190098E6F3 /* Project object */;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:CryptoSwift.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>classNames</key>
|
||||
<dict>
|
||||
<key>ChaCha20Tests</key>
|
||||
<dict>
|
||||
<key>testChaCha20Performance()</key>
|
||||
<dict>
|
||||
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
|
||||
<dict>
|
||||
<key>baselineAverage</key>
|
||||
<real>0.15</real>
|
||||
<key>baselineIntegrationDisplayName</key>
|
||||
<string>Local Baseline</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>classNames</key>
|
||||
<dict>
|
||||
<key>AESTests</key>
|
||||
<dict>
|
||||
<key>testAESPerformance()</key>
|
||||
<dict>
|
||||
<key>com.apple.XCTPerformanceMetric_WallClockTime</key>
|
||||
<dict>
|
||||
<key>baselineAverage</key>
|
||||
<real>14.71</real>
|
||||
<key>baselineIntegrationDisplayName</key>
|
||||
<string>Local Baseline</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,40 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>runDestinationsByUUID</key>
|
||||
<dict>
|
||||
<key>9396A4FE-F8F7-4542-8F75-DE77E1FEBEB9</key>
|
||||
<dict>
|
||||
<key>localComputer</key>
|
||||
<dict>
|
||||
<key>busSpeedInMHz</key>
|
||||
<integer>100</integer>
|
||||
<key>cpuCount</key>
|
||||
<integer>1</integer>
|
||||
<key>cpuKind</key>
|
||||
<string>Intel Core i7</string>
|
||||
<key>cpuSpeedInMHz</key>
|
||||
<integer>1700</integer>
|
||||
<key>logicalCPUCoresPerPackage</key>
|
||||
<integer>4</integer>
|
||||
<key>modelCode</key>
|
||||
<string>MacBookAir6,2</string>
|
||||
<key>physicalCPUCoresPerPackage</key>
|
||||
<integer>2</integer>
|
||||
<key>platformIdentifier</key>
|
||||
<string>com.apple.platform.macosx</string>
|
||||
</dict>
|
||||
<key>targetArchitecture</key>
|
||||
<string>x86_64</string>
|
||||
<key>targetDevice</key>
|
||||
<dict>
|
||||
<key>modelCode</key>
|
||||
<string>iPhone7,2</string>
|
||||
<key>platformIdentifier</key>
|
||||
<string>com.apple.platform.iphonesimulator</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,127 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "NO"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45419693E190098E6F3"
|
||||
BuildableName = "CryptoSwift.framework"
|
||||
BlueprintName = "CryptoSwift"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45F19693E190098E6F3"
|
||||
BuildableName = "CryptoSwiftTests.xctest"
|
||||
BlueprintName = "CryptoSwiftTests"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45F19693E190098E6F3"
|
||||
BuildableName = "CryptoSwiftTests.xctest"
|
||||
BlueprintName = "CryptoSwiftTests"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
<SkippedTests>
|
||||
<Test
|
||||
Identifier = "AESTests/testAESPerformance()">
|
||||
</Test>
|
||||
<Test
|
||||
Identifier = "AESTests/testAESPerformanceCommonCrypto()">
|
||||
</Test>
|
||||
<Test
|
||||
Identifier = "ChaCha20Tests/testChaCha20Performance()">
|
||||
</Test>
|
||||
<Test
|
||||
Identifier = "RaufelderTests">
|
||||
</Test>
|
||||
</SkippedTests>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45419693E190098E6F3"
|
||||
BuildableName = "CryptoSwift.framework"
|
||||
BlueprintName = "CryptoSwift"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45419693E190098E6F3"
|
||||
BuildableName = "CryptoSwift.framework"
|
||||
BlueprintName = "CryptoSwift"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "754BE45419693E190098E6F3"
|
||||
BuildableName = "CryptoSwift.framework"
|
||||
BlueprintName = "CryptoSwift"
|
||||
ReferencedContainer = "container:CryptoSwift.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,433 +0,0 @@
|
|||
//
|
||||
// AES.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 21/11/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final public class AES {
|
||||
|
||||
enum Error: ErrorType {
|
||||
case BlockSizeExceeded
|
||||
}
|
||||
|
||||
public enum AESVariant:Int {
|
||||
case aes128 = 1, aes192, aes256
|
||||
|
||||
var Nk:Int { // Nk words
|
||||
return [4,6,8][self.rawValue - 1]
|
||||
}
|
||||
|
||||
var Nb:Int { // Nb words
|
||||
return 4
|
||||
}
|
||||
|
||||
var Nr:Int { // Nr
|
||||
return Nk + 6
|
||||
}
|
||||
}
|
||||
|
||||
public let blockMode:CipherBlockMode
|
||||
public static let blockSize:Int = 16 // 128 /8
|
||||
|
||||
public var variant:AESVariant {
|
||||
switch (self.key.count * 8) {
|
||||
case 128:
|
||||
return .aes128
|
||||
case 192:
|
||||
return .aes192
|
||||
case 256:
|
||||
return .aes256
|
||||
default:
|
||||
preconditionFailure("Unknown AES variant for given key.")
|
||||
}
|
||||
}
|
||||
private let key:[UInt8]
|
||||
private let iv:[UInt8]?
|
||||
public lazy var expandedKey:[UInt8] = { AES.expandKey(self.key, variant: self.variant) }()
|
||||
|
||||
static private let sBox:[UInt8] = [
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
||||
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
|
||||
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
|
||||
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
|
||||
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
|
||||
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
|
||||
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
|
||||
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
|
||||
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
|
||||
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
|
||||
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
|
||||
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
|
||||
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
|
||||
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]
|
||||
|
||||
static private let invSBox:[UInt8] = [
|
||||
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3,
|
||||
0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f,
|
||||
0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54,
|
||||
0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b,
|
||||
0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24,
|
||||
0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8,
|
||||
0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d,
|
||||
0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda,
|
||||
0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab,
|
||||
0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3,
|
||||
0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1,
|
||||
0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41,
|
||||
0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6,
|
||||
0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9,
|
||||
0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d,
|
||||
0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
|
||||
0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0,
|
||||
0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07,
|
||||
0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60,
|
||||
0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f,
|
||||
0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5,
|
||||
0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b,
|
||||
0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55,
|
||||
0x21, 0x0c, 0x7d]
|
||||
|
||||
// Parameters for Linear Congruence Generators
|
||||
static private let Rcon:[UInt8] = [
|
||||
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a,
|
||||
0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39,
|
||||
0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
|
||||
0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
|
||||
0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef,
|
||||
0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
|
||||
0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b,
|
||||
0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3,
|
||||
0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
|
||||
0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20,
|
||||
0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35,
|
||||
0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
|
||||
0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04,
|
||||
0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63,
|
||||
0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
|
||||
0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]
|
||||
|
||||
public init?(key:[UInt8], iv:[UInt8], blockMode:CipherBlockMode = .CBC) {
|
||||
self.key = key
|
||||
self.iv = iv
|
||||
self.blockMode = blockMode
|
||||
|
||||
if (blockMode.needIV && iv.count != AES.blockSize) {
|
||||
assert(false, "Block size and Initialization Vector must be the same length!")
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
convenience public init?(key:[UInt8], blockMode:CipherBlockMode = .CBC) {
|
||||
// default IV is all 0x00...
|
||||
let defaultIV = [UInt8](count: AES.blockSize, repeatedValue: 0)
|
||||
self.init(key: key, iv: defaultIV, blockMode: blockMode)
|
||||
}
|
||||
|
||||
convenience public init?(key:String, iv:String, blockMode:CipherBlockMode = .CBC) {
|
||||
if let kkey = key.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.arrayOfBytes(), let iiv = iv.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.arrayOfBytes() {
|
||||
self.init(key: kkey, iv: iiv, blockMode: blockMode)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Encrypt message. If padding is necessary, then PKCS7 padding is added and needs to be removed after decryption.
|
||||
|
||||
- parameter message: Plaintext data
|
||||
|
||||
- returns: Encrypted data
|
||||
*/
|
||||
|
||||
public func encrypt(bytes:[UInt8], padding:Padding? = PKCS7()) throws -> [UInt8] {
|
||||
var finalBytes = bytes;
|
||||
|
||||
if let padding = padding {
|
||||
finalBytes = padding.add(bytes, blockSize: AES.blockSize)
|
||||
} else if bytes.count % AES.blockSize != 0 {
|
||||
throw Error.BlockSizeExceeded
|
||||
}
|
||||
|
||||
let blocks = finalBytes.chunks(AES.blockSize) // 0.34
|
||||
return try blockMode.encryptBlocks(blocks, iv: self.iv, cipherOperation: encryptBlock)
|
||||
}
|
||||
|
||||
private func encryptBlock(block:[UInt8]) -> [UInt8]? {
|
||||
var out:[UInt8] = [UInt8]()
|
||||
|
||||
autoreleasepool { () -> () in
|
||||
var state:[[UInt8]] = [[UInt8]](count: variant.Nb, repeatedValue: [UInt8](count: variant.Nb, repeatedValue: 0))
|
||||
for (i, row) in state.enumerate() {
|
||||
for (j, _) in row.enumerate() {
|
||||
state[j][i] = block[i * row.count + j]
|
||||
}
|
||||
}
|
||||
|
||||
state = addRoundKey(state,expandedKey, 0)
|
||||
|
||||
for roundCount in 1..<variant.Nr {
|
||||
subBytes(&state)
|
||||
state = shiftRows(state)
|
||||
state = mixColumns(state)
|
||||
state = addRoundKey(state, expandedKey, roundCount)
|
||||
}
|
||||
|
||||
subBytes(&state)
|
||||
state = shiftRows(state)
|
||||
state = addRoundKey(state, expandedKey, variant.Nr)
|
||||
|
||||
|
||||
out = [UInt8](count: state.count * state.first!.count, repeatedValue: 0)
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[i].count {
|
||||
out[(i * 4) + j] = state[j][i]
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
public func decrypt(bytes:[UInt8], padding:Padding? = PKCS7()) throws -> [UInt8] {
|
||||
if bytes.count % AES.blockSize != 0 {
|
||||
throw Error.BlockSizeExceeded
|
||||
}
|
||||
|
||||
let blocks = bytes.chunks(AES.blockSize)
|
||||
let out:[UInt8]
|
||||
switch (blockMode) {
|
||||
case .CFB, .CTR:
|
||||
// CFB, CTR uses encryptBlock to decrypt
|
||||
out = try blockMode.decryptBlocks(blocks, iv: self.iv, cipherOperation: encryptBlock)
|
||||
default:
|
||||
out = try blockMode.decryptBlocks(blocks, iv: self.iv, cipherOperation: decryptBlock)
|
||||
}
|
||||
|
||||
if let padding = padding {
|
||||
return padding.remove(out, blockSize: nil)
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
private func decryptBlock(block:[UInt8]) -> [UInt8]? {
|
||||
var state:[[UInt8]] = [[UInt8]](count: variant.Nb, repeatedValue: [UInt8](count: variant.Nb, repeatedValue: 0))
|
||||
for (i, row) in state.enumerate() {
|
||||
for (j, _) in row.enumerate() {
|
||||
state[j][i] = block[i * row.count + j]
|
||||
}
|
||||
}
|
||||
|
||||
state = addRoundKey(state,expandedKey, variant.Nr)
|
||||
|
||||
for roundCount in (1..<variant.Nr).reverse() {
|
||||
state = invShiftRows(state)
|
||||
state = invSubBytes(state)
|
||||
state = addRoundKey(state, expandedKey, roundCount)
|
||||
state = invMixColumns(state)
|
||||
}
|
||||
|
||||
state = invShiftRows(state)
|
||||
state = invSubBytes(state)
|
||||
state = addRoundKey(state, expandedKey, 0)
|
||||
|
||||
var out:[UInt8] = [UInt8]()
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[0].count {
|
||||
out.append(state[j][i])
|
||||
}
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
static private func expandKey(key:[UInt8], variant:AESVariant) -> [UInt8] {
|
||||
|
||||
/*
|
||||
* Function used in the Key Expansion routine that takes a four-byte
|
||||
* input word and applies an S-box to each of the four bytes to
|
||||
* produce an output word.
|
||||
*/
|
||||
func subWord(word:[UInt8]) -> [UInt8] {
|
||||
var result = word
|
||||
for i in 0..<4 {
|
||||
result[i] = self.sBox[Int(word[i])]
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
var w = [UInt8](count: variant.Nb * (variant.Nr + 1) * 4, repeatedValue: 0)
|
||||
for i in 0..<variant.Nk {
|
||||
for wordIdx in 0..<4 {
|
||||
w[(4*i)+wordIdx] = key[(4*i)+wordIdx]
|
||||
}
|
||||
}
|
||||
|
||||
var tmp:[UInt8]
|
||||
for (var i = variant.Nk; i < variant.Nb * (variant.Nr + 1); i++) {
|
||||
tmp = [UInt8](count: 4, repeatedValue: 0)
|
||||
|
||||
for wordIdx in 0..<4 {
|
||||
tmp[wordIdx] = w[4*(i-1)+wordIdx]
|
||||
}
|
||||
if ((i % variant.Nk) == 0) {
|
||||
let rotWord = rotateLeft(UInt32.withBytes(tmp), n: 8).bytes(sizeof(UInt32)) // RotWord
|
||||
tmp = subWord(rotWord)
|
||||
tmp[0] = tmp[0] ^ Rcon[i/variant.Nk]
|
||||
} else if (variant.Nk > 6 && (i % variant.Nk) == 4) {
|
||||
tmp = subWord(tmp)
|
||||
}
|
||||
|
||||
// xor array of bytes
|
||||
for wordIdx in 0..<4 {
|
||||
w[4*i+wordIdx] = w[4*(i-variant.Nk)+wordIdx]^tmp[wordIdx];
|
||||
}
|
||||
}
|
||||
return w;
|
||||
}
|
||||
}
|
||||
|
||||
extension AES {
|
||||
|
||||
// byte substitution with table (S-box)
|
||||
public func subBytes(inout state:[[UInt8]]) {
|
||||
for (i,row) in state.enumerate() {
|
||||
for (j,value) in row.enumerate() {
|
||||
state[i][j] = AES.sBox[Int(value)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func invSubBytes(state:[[UInt8]]) -> [[UInt8]] {
|
||||
var result = state
|
||||
for (i,row) in state.enumerate() {
|
||||
for (j,value) in row.enumerate() {
|
||||
result[i][j] = AES.invSBox[Int(value)]
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Applies a cyclic shift to the last 3 rows of a state matrix.
|
||||
public func shiftRows(state:[[UInt8]]) -> [[UInt8]] {
|
||||
var result = state
|
||||
for r in 1..<4 {
|
||||
for c in 0..<variant.Nb {
|
||||
result[r][c] = state[r][(c + r) % variant.Nb]
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public func invShiftRows(state:[[UInt8]]) -> [[UInt8]] {
|
||||
var result = state
|
||||
for r in 1..<4 {
|
||||
for c in 0..<variant.Nb {
|
||||
result[r][(c + r) % variant.Nb] = state[r][c]
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Multiplies two polynomials
|
||||
public func multiplyPolys(a:UInt8, _ b:UInt8) -> UInt8 {
|
||||
var a = a, b = b
|
||||
var p:UInt8 = 0, hbs:UInt8 = 0
|
||||
|
||||
for _ in 0..<8 {
|
||||
if (b & 1 == 1) {
|
||||
p ^= a
|
||||
}
|
||||
hbs = a & 0x80
|
||||
a <<= 1
|
||||
if (hbs > 0) {
|
||||
a ^= 0x1B
|
||||
}
|
||||
b >>= 1
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
||||
public func matrixMultiplyPolys(matrix:[[UInt8]], _ array:[UInt8]) -> [UInt8] {
|
||||
var returnArray:[UInt8] = [UInt8](count: array.count, repeatedValue: 0)
|
||||
for (i, row) in matrix.enumerate() {
|
||||
for (j, boxVal) in row.enumerate() {
|
||||
returnArray[i] = multiplyPolys(boxVal, array[j]) ^ returnArray[i]
|
||||
}
|
||||
}
|
||||
return returnArray
|
||||
}
|
||||
|
||||
public func addRoundKey(state:[[UInt8]], _ expandedKeyW:[UInt8], _ round:Int) -> [[UInt8]] {
|
||||
var newState = [[UInt8]](count: state.count, repeatedValue: [UInt8](count: variant.Nb, repeatedValue: 0))
|
||||
let idxRow = 4*variant.Nb*round
|
||||
for c in 0..<variant.Nb {
|
||||
let idxCol = variant.Nb*c
|
||||
newState[0][c] = state[0][c] ^ expandedKeyW[idxRow+idxCol+0]
|
||||
newState[1][c] = state[1][c] ^ expandedKeyW[idxRow+idxCol+1]
|
||||
newState[2][c] = state[2][c] ^ expandedKeyW[idxRow+idxCol+2]
|
||||
newState[3][c] = state[3][c] ^ expandedKeyW[idxRow+idxCol+3]
|
||||
}
|
||||
return newState
|
||||
}
|
||||
|
||||
// mixes data (independently of one another)
|
||||
public func mixColumns(state:[[UInt8]]) -> [[UInt8]] {
|
||||
var state = state
|
||||
let colBox:[[UInt8]] = [[2,3,1,1],[1,2,3,1],[1,1,2,3],[3,1,1,2]]
|
||||
|
||||
var rowMajorState = [[UInt8]](count: state.count, repeatedValue: [UInt8](count: state.first!.count, repeatedValue: 0)) //state.map({ val -> [UInt8] in return val.map { _ in return 0 } }) // zeroing
|
||||
var newRowMajorState = rowMajorState
|
||||
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[0].count {
|
||||
rowMajorState[j][i] = state[i][j]
|
||||
}
|
||||
}
|
||||
|
||||
for (i, row) in rowMajorState.enumerate() {
|
||||
newRowMajorState[i] = matrixMultiplyPolys(colBox, row)
|
||||
}
|
||||
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[0].count {
|
||||
state[i][j] = newRowMajorState[j][i]
|
||||
}
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
|
||||
public func invMixColumns(state:[[UInt8]]) -> [[UInt8]] {
|
||||
var state = state
|
||||
let invColBox:[[UInt8]] = [[14,11,13,9],[9,14,11,13],[13,9,14,11],[11,13,9,14]]
|
||||
|
||||
var colOrderState = state.map({ val -> [UInt8] in return val.map { _ in return 0 } }) // zeroing
|
||||
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[0].count {
|
||||
colOrderState[j][i] = state[i][j]
|
||||
}
|
||||
}
|
||||
|
||||
var newState = state.map({ val -> [UInt8] in return val.map { _ in return 0 } })
|
||||
|
||||
for (i, row) in colOrderState.enumerate() {
|
||||
newState[i] = matrixMultiplyPolys(invColBox, row)
|
||||
}
|
||||
|
||||
for i in 0..<state.count {
|
||||
for j in 0..<state[0].count {
|
||||
state[i][j] = newState[j][i]
|
||||
}
|
||||
}
|
||||
|
||||
return state
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// ArrayExtension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 10/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Array {
|
||||
|
||||
/** split in chunks with given chunk size */
|
||||
func chunks(chunksize:Int) -> [Array<Element>] {
|
||||
var words = [[Element]]()
|
||||
words.reserveCapacity(self.count / chunksize)
|
||||
for var idx = chunksize; idx <= self.count; idx = idx + chunksize {
|
||||
let word = Array(self[idx - chunksize..<idx]) // this is slow for large table
|
||||
words.append(word)
|
||||
}
|
||||
let reminder = Array(self.suffix(self.count % chunksize))
|
||||
if (reminder.count > 0) {
|
||||
words.append(reminder)
|
||||
}
|
||||
return words
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
//
|
||||
// MAC.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 03/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/**
|
||||
* Message Authentication
|
||||
*/
|
||||
public enum Authenticator {
|
||||
/**
|
||||
Poly1305
|
||||
|
||||
- parameter key: 256-bit key
|
||||
*/
|
||||
case Poly1305(key: [UInt8])
|
||||
case HMAC(key: [UInt8], variant:CryptoSwift.HMAC.Variant)
|
||||
|
||||
/**
|
||||
Generates an authenticator for message using a one-time key and returns the 16-byte result
|
||||
|
||||
- returns: 16-byte message authentication code
|
||||
*/
|
||||
public func authenticate(message: [UInt8]) -> [UInt8]? {
|
||||
switch (self) {
|
||||
case .Poly1305(let key):
|
||||
return CryptoSwift.Poly1305.authenticate(key: key, message: message)
|
||||
case .HMAC(let key, let variant):
|
||||
return CryptoSwift.HMAC.authenticate(key: key, message: message, variant: variant)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
//
|
||||
// BitExtension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 01/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Bit {
|
||||
|
||||
func inverted() -> Bit {
|
||||
if (self == Bit.Zero) {
|
||||
return Bit.One
|
||||
}
|
||||
|
||||
return Bit.Zero
|
||||
}
|
||||
|
||||
mutating func invert() {
|
||||
self = self.inverted()
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
//
|
||||
// CRC.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 25/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class CRC {
|
||||
|
||||
private let table:[UInt32] = [0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
|
||||
0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
||||
0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
||||
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
|
||||
0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
|
||||
0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
|
||||
0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
||||
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
|
||||
0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
|
||||
0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
|
||||
0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
|
||||
0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
|
||||
0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
|
||||
0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
||||
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
|
||||
0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
|
||||
0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d]
|
||||
|
||||
func crc32(message:NSData) -> NSData {
|
||||
var crc:UInt32 = 0xffffffff
|
||||
|
||||
for chunk in NSDataSequence(chunkSize: 256, data: message) {
|
||||
for b in chunk.arrayOfBytes() {
|
||||
let idx = Int((crc ^ UInt32(b)) & 0xff)
|
||||
crc = (crc >> 8) ^ table[idx]
|
||||
}
|
||||
}
|
||||
|
||||
crc = crc ^ 0xffffffff
|
||||
|
||||
// reverse bytes
|
||||
let bytes = Array(NSMutableData(bytes: &crc, length: 4).arrayOfBytes().reverse()) //FIXME: Array ??
|
||||
let data = NSData(bytes: bytes, length: bytes.count)
|
||||
return data
|
||||
}
|
||||
|
||||
}
|
|
@ -1,202 +0,0 @@
|
|||
//
|
||||
// ChaCha20.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 25/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final public class ChaCha20 {
|
||||
|
||||
enum Error: ErrorType {
|
||||
case MissingContext
|
||||
}
|
||||
|
||||
static let blockSize = 64 // 512 / 8
|
||||
private let stateSize = 16
|
||||
private var context:Context?
|
||||
|
||||
final private class Context {
|
||||
var input:[UInt32] = [UInt32](count: 16, repeatedValue: 0)
|
||||
|
||||
deinit {
|
||||
for (var i = 0; i < input.count; i++) {
|
||||
input[i] = 0x00;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public init?(key:[UInt8], iv:[UInt8]) {
|
||||
if let c = contextSetup(iv: iv, key: key) {
|
||||
context = c
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
convenience public init?(key:String, iv:String) {
|
||||
if let kkey = key.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.arrayOfBytes(), let iiv = iv.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.arrayOfBytes() {
|
||||
self.init(key: kkey, iv: iiv)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
public func encrypt(bytes:[UInt8]) throws -> [UInt8] {
|
||||
guard context != nil else {
|
||||
throw Error.MissingContext
|
||||
}
|
||||
|
||||
return try encryptBytes(bytes)
|
||||
}
|
||||
|
||||
public func decrypt(bytes:[UInt8]) throws -> [UInt8] {
|
||||
return try encrypt(bytes)
|
||||
}
|
||||
|
||||
private final func wordToByte(input:[UInt32] /* 64 */) -> [UInt8]? /* 16 */ {
|
||||
if (input.count != stateSize) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
var x = input
|
||||
|
||||
var i = 10
|
||||
while (i > 0) {
|
||||
quarterround(&x[0], &x[4], &x[8], &x[12])
|
||||
quarterround(&x[1], &x[5], &x[9], &x[13])
|
||||
quarterround(&x[2], &x[6], &x[10], &x[14])
|
||||
quarterround(&x[3], &x[7], &x[11], &x[15])
|
||||
quarterround(&x[0], &x[5], &x[10], &x[15])
|
||||
quarterround(&x[1], &x[6], &x[11], &x[12])
|
||||
quarterround(&x[2], &x[7], &x[8], &x[13])
|
||||
quarterround(&x[3], &x[4], &x[9], &x[14])
|
||||
i -= 2
|
||||
}
|
||||
|
||||
var output = [UInt8]()
|
||||
output.reserveCapacity(16)
|
||||
|
||||
for i in 0..<16 {
|
||||
x[i] = x[i] &+ input[i]
|
||||
output.appendContentsOf([UInt8((x[i] & 0xFFFFFFFF) >> 24),
|
||||
UInt8((x[i] & 0xFFFFFF) >> 16),
|
||||
UInt8((x[i] & 0xFFFF) >> 8),
|
||||
UInt8((x[i] & 0xFF) >> 0)])
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private func contextSetup(iv iv:[UInt8], key:[UInt8]) -> Context? {
|
||||
let ctx = Context()
|
||||
let kbits = key.count * 8
|
||||
|
||||
if (kbits != 128 && kbits != 256) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 4 - 8
|
||||
for (var i = 0; i < 4; i++) {
|
||||
let start = i * 4
|
||||
ctx.input[i + 4] = wordNumber(key[start..<(start + 4)])
|
||||
}
|
||||
|
||||
var addPos = 0;
|
||||
switch (kbits) {
|
||||
case 256:
|
||||
addPos += 16
|
||||
// sigma
|
||||
ctx.input[0] = 0x61707865 //apxe
|
||||
ctx.input[1] = 0x3320646e //3 dn
|
||||
ctx.input[2] = 0x79622d32 //yb-2
|
||||
ctx.input[3] = 0x6b206574 //k et
|
||||
default:
|
||||
// tau
|
||||
ctx.input[0] = 0x61707865 //apxe
|
||||
ctx.input[1] = 0x3620646e //6 dn
|
||||
ctx.input[2] = 0x79622d31 //yb-1
|
||||
ctx.input[3] = 0x6b206574 //k et
|
||||
break;
|
||||
}
|
||||
|
||||
// 8 - 11
|
||||
for (var i = 0; i < 4; i++) {
|
||||
let start = addPos + (i*4)
|
||||
|
||||
let bytes = key[start..<(start + 4)]
|
||||
ctx.input[i + 8] = wordNumber(bytes)
|
||||
}
|
||||
|
||||
// iv
|
||||
ctx.input[12] = 0
|
||||
ctx.input[13] = 0
|
||||
ctx.input[14] = wordNumber(iv[0..<4])
|
||||
ctx.input[15] = wordNumber(iv[4..<8])
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
||||
private final func encryptBytes(message:[UInt8]) throws -> [UInt8] {
|
||||
|
||||
guard let ctx = context else {
|
||||
throw Error.MissingContext
|
||||
}
|
||||
|
||||
var c:[UInt8] = [UInt8](count: message.count, repeatedValue: 0)
|
||||
|
||||
var cPos:Int = 0
|
||||
var mPos:Int = 0
|
||||
var bytes = message.count
|
||||
|
||||
while (true) {
|
||||
if let output = wordToByte(ctx.input) {
|
||||
ctx.input[12] = ctx.input[12] &+ 1
|
||||
if (ctx.input[12] == 0) {
|
||||
ctx.input[13] = ctx.input[13] &+ 1
|
||||
/* stopping at 2^70 bytes per nonce is user's responsibility */
|
||||
}
|
||||
if (bytes <= ChaCha20.blockSize) {
|
||||
for (var i = 0; i < bytes; i++) {
|
||||
c[i + cPos] = message[i + mPos] ^ output[i]
|
||||
}
|
||||
return c
|
||||
}
|
||||
for (var i = 0; i < ChaCha20.blockSize; i++) {
|
||||
c[i + cPos] = message[i + mPos] ^ output[i]
|
||||
}
|
||||
bytes -= ChaCha20.blockSize
|
||||
cPos += ChaCha20.blockSize
|
||||
mPos += ChaCha20.blockSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final func quarterround(inout a:UInt32, inout _ b:UInt32, inout _ c:UInt32, inout _ d:UInt32) {
|
||||
a = a &+ b
|
||||
d = rotateLeft((d ^ a), n: 16) //FIXME: WAT? n:
|
||||
|
||||
c = c &+ d
|
||||
b = rotateLeft((b ^ c), n: 12);
|
||||
|
||||
a = a &+ b
|
||||
d = rotateLeft((d ^ a), n: 8);
|
||||
|
||||
c = c &+ d
|
||||
b = rotateLeft((b ^ c), n: 7);
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Helpers
|
||||
|
||||
/// Change array to number. It's here because arrayOfBytes is too slow
|
||||
private func wordNumber(bytes:ArraySlice<UInt8>) -> UInt32 {
|
||||
var value:UInt32 = 0
|
||||
for (var i:UInt32 = 0, j = bytes.startIndex; i < 4; i++, j++) {
|
||||
value = value | UInt32(bytes[j]) << (8 * i)
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
//
|
||||
// Cipher.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 30/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum Cipher {
|
||||
|
||||
public enum Error: ErrorType {
|
||||
case EncryptError
|
||||
case DecryptError
|
||||
}
|
||||
|
||||
/**
|
||||
ChaCha20
|
||||
|
||||
- parameter key: Encryption key
|
||||
- parameter iv: Initialization Vector
|
||||
|
||||
- returns: Value of Cipher
|
||||
*/
|
||||
case ChaCha20(key: [UInt8], iv: [UInt8])
|
||||
/**
|
||||
AES
|
||||
|
||||
- parameter key: Encryption key
|
||||
- parameter iv: Initialization Vector
|
||||
- parameter blockMode: Block mode (CBC by default)
|
||||
|
||||
- returns: Value of Cipher
|
||||
*/
|
||||
case AES(key: [UInt8], iv: [UInt8], blockMode: CipherBlockMode)
|
||||
|
||||
/**
|
||||
Encrypt message
|
||||
|
||||
- parameter message: Plaintext message
|
||||
|
||||
- returns: encrypted message
|
||||
*/
|
||||
public func encrypt(bytes: [UInt8]) throws -> [UInt8] {
|
||||
switch (self) {
|
||||
case .ChaCha20(let key, let iv):
|
||||
guard let chacha = CryptoSwift.ChaCha20(key: key, iv: iv) else {
|
||||
throw Error.EncryptError
|
||||
}
|
||||
return try chacha.encrypt(bytes)
|
||||
case .AES(let key, let iv, let blockMode):
|
||||
guard let aes = CryptoSwift.AES(key: key, iv: iv, blockMode: blockMode) else {
|
||||
throw Error.EncryptError
|
||||
}
|
||||
return try aes.encrypt(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Decrypt message
|
||||
|
||||
- parameter message: Message data
|
||||
|
||||
- returns: Plaintext message
|
||||
*/
|
||||
public func decrypt(bytes: [UInt8]) throws -> [UInt8] {
|
||||
switch (self) {
|
||||
case .ChaCha20(let key, let iv):
|
||||
guard let chacha = CryptoSwift.ChaCha20(key: key, iv: iv) else {
|
||||
throw Error.DecryptError
|
||||
}
|
||||
return try chacha.decrypt(bytes)
|
||||
case .AES(let key, let iv, let blockMode):
|
||||
guard let aes = CryptoSwift.AES(key: key, iv: iv, blockMode: blockMode) else {
|
||||
throw Error.DecryptError
|
||||
}
|
||||
return try aes.decrypt(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
static public func randomIV(blockSize:Int) -> [UInt8] {
|
||||
var randomIV:[UInt8] = [UInt8]();
|
||||
for (var i = 0; i < blockSize; i++) {
|
||||
randomIV.append(UInt8(truncatingBitPattern: arc4random_uniform(256)));
|
||||
}
|
||||
return randomIV
|
||||
}
|
||||
}
|
|
@ -1,223 +0,0 @@
|
|||
//
|
||||
// CipherBlockMode.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/12/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
// I have no better name for that
|
||||
typealias CipherOperationOnBlock = (block: [UInt8]) -> [UInt8]?
|
||||
|
||||
enum BlockError: ErrorType {
|
||||
case MissingInitializationVector
|
||||
}
|
||||
|
||||
private protocol BlockMode {
|
||||
var needIV:Bool { get }
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8]
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8]
|
||||
}
|
||||
|
||||
public enum CipherBlockMode {
|
||||
case ECB, CBC, CFB, CTR
|
||||
|
||||
private var mode:BlockMode {
|
||||
switch (self) {
|
||||
case CBC:
|
||||
return CBCMode()
|
||||
case CFB:
|
||||
return CFBMode()
|
||||
case ECB:
|
||||
return ECBMode()
|
||||
case CTR:
|
||||
return CTRMode()
|
||||
}
|
||||
}
|
||||
|
||||
var needIV: Bool {
|
||||
return mode.needIV
|
||||
}
|
||||
|
||||
/**
|
||||
Process input blocks with given block cipher mode. With fallback to plain mode.
|
||||
|
||||
- parameter blocks: cipher block size blocks
|
||||
- parameter iv: IV
|
||||
- parameter cipher: single block encryption closure
|
||||
|
||||
- returns: encrypted bytes
|
||||
*/
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
|
||||
// if IV is not available, fallback to plain
|
||||
var finalBlockMode:CipherBlockMode = self
|
||||
if (iv == nil) {
|
||||
finalBlockMode = .ECB
|
||||
}
|
||||
|
||||
return try finalBlockMode.mode.encryptBlocks(blocks, iv: iv, cipherOperation: cipherOperation)
|
||||
}
|
||||
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
// if IV is not available, fallback to plain
|
||||
var finalBlockMode:CipherBlockMode = self
|
||||
if (iv == nil) {
|
||||
finalBlockMode = .ECB
|
||||
}
|
||||
|
||||
return try finalBlockMode.mode.decryptBlocks(blocks, iv: iv, cipherOperation: cipherOperation)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Cipher-block chaining (CBC)
|
||||
*/
|
||||
private struct CBCMode: BlockMode {
|
||||
let needIV = true
|
||||
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
precondition(blocks.count > 0)
|
||||
guard let iv = iv else {
|
||||
throw BlockError.MissingInitializationVector
|
||||
}
|
||||
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
var prevCiphertext = iv // for the first time prevCiphertext = iv
|
||||
for plaintext in blocks {
|
||||
if let encrypted = cipherOperation(block: xor(prevCiphertext, b: plaintext)) {
|
||||
out.appendContentsOf(encrypted)
|
||||
prevCiphertext = encrypted
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
precondition(blocks.count > 0)
|
||||
guard let iv = iv else {
|
||||
throw BlockError.MissingInitializationVector
|
||||
}
|
||||
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
var prevCiphertext = iv // for the first time prevCiphertext = iv
|
||||
for ciphertext in blocks {
|
||||
if let decrypted = cipherOperation(block: ciphertext) { // decrypt
|
||||
out.appendContentsOf(xor(prevCiphertext, b: decrypted)) //FIXME: b:
|
||||
}
|
||||
prevCiphertext = ciphertext
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Cipher feedback (CFB)
|
||||
*/
|
||||
private struct CFBMode: BlockMode {
|
||||
let needIV = true
|
||||
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
guard let iv = iv else {
|
||||
throw BlockError.MissingInitializationVector
|
||||
}
|
||||
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
|
||||
var lastCiphertext = iv
|
||||
for plaintext in blocks {
|
||||
if let encrypted = cipherOperation(block: lastCiphertext) {
|
||||
lastCiphertext = xor(plaintext,b: encrypted)
|
||||
out.appendContentsOf(lastCiphertext)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
return try encryptBlocks(blocks, iv: iv, cipherOperation: cipherOperation)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Electronic codebook (ECB)
|
||||
*/
|
||||
private struct ECBMode: BlockMode {
|
||||
let needIV = false
|
||||
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) -> [UInt8] {
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
for plaintext in blocks {
|
||||
if let encrypted = cipherOperation(block: plaintext) {
|
||||
out.appendContentsOf(encrypted)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) -> [UInt8] {
|
||||
return encryptBlocks(blocks, iv: iv, cipherOperation: cipherOperation)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Counter (CTR)
|
||||
*/
|
||||
private struct CTRMode: BlockMode {
|
||||
let needIV = true
|
||||
|
||||
private func buildNonce(iv: [UInt8], counter: UInt) -> [UInt8] {
|
||||
let noncePartLen = AES.blockSize / 2
|
||||
let noncePrefix = Array(iv[0..<noncePartLen])
|
||||
let nonceSuffix = arrayOfBytes(counter, length: noncePartLen)
|
||||
|
||||
var nonce = noncePrefix
|
||||
nonce += nonceSuffix
|
||||
return nonce
|
||||
}
|
||||
|
||||
func encryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
//var counter:UInt = 17940646550795321087
|
||||
|
||||
guard let iv = iv else {
|
||||
throw BlockError.MissingInitializationVector
|
||||
}
|
||||
|
||||
var counter:UInt = 0
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
for plaintext in blocks {
|
||||
let nonce = buildNonce(iv, counter: counter++)
|
||||
if let encrypted = cipherOperation(block: nonce) {
|
||||
out.appendContentsOf(xor(plaintext, b: encrypted))
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func decryptBlocks(blocks:[[UInt8]], iv:[UInt8]?, cipherOperation:CipherOperationOnBlock) throws -> [UInt8] {
|
||||
guard let iv = iv else {
|
||||
throw BlockError.MissingInitializationVector
|
||||
}
|
||||
|
||||
var counter:UInt = 0
|
||||
var out:[UInt8] = [UInt8]()
|
||||
out.reserveCapacity(blocks.count * blocks[0].count)
|
||||
for plaintext in blocks {
|
||||
let nonce = buildNonce(iv, counter: counter++)
|
||||
if let encrypted = cipherOperation(block: nonce) {
|
||||
out.appendContentsOf(xor(encrypted, b: plaintext))
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// CryptoSwift.h
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 06/07/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for CryptoSwift.
|
||||
FOUNDATION_EXPORT double CryptoSwiftVersionNumber;
|
||||
|
||||
//! Project version string for CryptoSwift.
|
||||
FOUNDATION_EXPORT const unsigned char CryptoSwiftVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <CryptoSwift/PublicHeader.h>
|
||||
|
||||
|
|
@ -1,155 +0,0 @@
|
|||
//
|
||||
// Generics.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** Protocol and extensions for integerFromBitsArray. Bit hakish for me, but I can't do it in any other way */
|
||||
protocol Initiable {
|
||||
init(_ v: Int)
|
||||
init(_ v: UInt)
|
||||
}
|
||||
|
||||
extension Int:Initiable {}
|
||||
extension UInt:Initiable {}
|
||||
extension UInt8:Initiable {}
|
||||
extension UInt16:Initiable {}
|
||||
extension UInt32:Initiable {}
|
||||
extension UInt64:Initiable {}
|
||||
|
||||
/** build bit pattern from array of bits */
|
||||
func integerFromBitsArray<T: UnsignedIntegerType>(bits: [Bit]) -> T
|
||||
{
|
||||
var bitPattern:T = 0
|
||||
for (idx,b) in bits.enumerate() {
|
||||
if (b == Bit.One) {
|
||||
let bit = T(UIntMax(1) << UIntMax(idx))
|
||||
bitPattern = bitPattern | bit
|
||||
}
|
||||
}
|
||||
return bitPattern
|
||||
}
|
||||
|
||||
/// Initialize integer from array of bytes.
|
||||
/// This method may be slow
|
||||
func integerWithBytes<T: IntegerType where T:ByteConvertible, T: BitshiftOperationsType>(bytes: [UInt8]) -> T {
|
||||
var bytes = bytes.reverse() as Array<UInt8> //FIXME: check it this is equivalent of Array(...)
|
||||
if bytes.count < sizeof(T) {
|
||||
let paddingCount = sizeof(T) - bytes.count
|
||||
if (paddingCount > 0) {
|
||||
bytes += [UInt8](count: paddingCount, repeatedValue: 0)
|
||||
}
|
||||
}
|
||||
|
||||
if sizeof(T) == 1 {
|
||||
return T(truncatingBitPattern: UInt64(bytes[0]))
|
||||
}
|
||||
|
||||
var result: T = 0
|
||||
for byte in Array(bytes.reverse()) { //FIXME: Array??
|
||||
result = result << 8 | T(byte)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
/// Array of bytes, little-endian representation. Don't use if not necessary.
|
||||
/// I found this method slow
|
||||
func arrayOfBytes<T>(value:T, length:Int? = nil) -> [UInt8] {
|
||||
let totalBytes = length ?? sizeof(T)
|
||||
|
||||
let valuePointer = UnsafeMutablePointer<T>.alloc(1)
|
||||
valuePointer.memory = value
|
||||
|
||||
let bytesPointer = UnsafeMutablePointer<UInt8>(valuePointer)
|
||||
var bytes = [UInt8](count: totalBytes, repeatedValue: 0)
|
||||
for j in 0..<min(sizeof(T),totalBytes) {
|
||||
bytes[totalBytes - 1 - j] = (bytesPointer + j).memory
|
||||
}
|
||||
|
||||
valuePointer.destroy()
|
||||
valuePointer.dealloc(1)
|
||||
|
||||
return bytes
|
||||
}
|
||||
|
||||
// MARK: - shiftLeft
|
||||
|
||||
// helper to be able tomake shift operation on T
|
||||
func << <T:SignedIntegerType>(lhs: T, rhs: Int) -> Int {
|
||||
let a = lhs as! Int
|
||||
let b = rhs
|
||||
return a << b
|
||||
}
|
||||
|
||||
func << <T:UnsignedIntegerType>(lhs: T, rhs: Int) -> UInt {
|
||||
let a = lhs as! UInt
|
||||
let b = rhs
|
||||
return a << b
|
||||
}
|
||||
|
||||
// Generic function itself
|
||||
// FIXME: this generic function is not as generic as I would. It crashes for smaller types
|
||||
func shiftLeft<T: SignedIntegerType where T: Initiable>(value: T, count: Int) -> T {
|
||||
if (value == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
let bitsCount = (sizeofValue(value) * 8)
|
||||
let shiftCount = Int(Swift.min(count, bitsCount - 1))
|
||||
|
||||
var shiftedValue:T = 0;
|
||||
for bitIdx in 0..<bitsCount {
|
||||
let bit = T(IntMax(1 << bitIdx))
|
||||
if ((value & bit) == bit) {
|
||||
shiftedValue = shiftedValue | T(bit << shiftCount)
|
||||
}
|
||||
}
|
||||
|
||||
if (shiftedValue != 0 && count >= bitsCount) {
|
||||
// clear last bit that couldn't be shifted out of range
|
||||
shiftedValue = shiftedValue & T(~(1 << (bitsCount - 1)))
|
||||
}
|
||||
return shiftedValue
|
||||
}
|
||||
|
||||
// for any f*** other Integer type - this part is so non-Generic
|
||||
func shiftLeft(value: UInt, count: Int) -> UInt {
|
||||
return UInt(shiftLeft(Int(value), count: count)) //FIXME: count:
|
||||
}
|
||||
|
||||
func shiftLeft(value: UInt8, count: Int) -> UInt8 {
|
||||
return UInt8(shiftLeft(UInt(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: UInt16, count: Int) -> UInt16 {
|
||||
return UInt16(shiftLeft(UInt(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: UInt32, count: Int) -> UInt32 {
|
||||
return UInt32(shiftLeft(UInt(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: UInt64, count: Int) -> UInt64 {
|
||||
return UInt64(shiftLeft(UInt(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: Int8, count: Int) -> Int8 {
|
||||
return Int8(shiftLeft(Int(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: Int16, count: Int) -> Int16 {
|
||||
return Int16(shiftLeft(Int(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: Int32, count: Int) -> Int32 {
|
||||
return Int32(shiftLeft(Int(value), count: count))
|
||||
}
|
||||
|
||||
func shiftLeft(value: Int64, count: Int) -> Int64 {
|
||||
return Int64(shiftLeft(Int(value), count: count))
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
//
|
||||
// HMAC.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 13/01/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final public class HMAC {
|
||||
|
||||
public enum Variant {
|
||||
case sha1, sha256, sha384, sha512, md5
|
||||
|
||||
var size:Int {
|
||||
switch (self) {
|
||||
case .sha1:
|
||||
return SHA1(NSData()).size
|
||||
case .sha256:
|
||||
return SHA2.Variant.sha256.size
|
||||
case .sha384:
|
||||
return SHA2.Variant.sha384.size
|
||||
case .sha512:
|
||||
return SHA2.Variant.sha512.size
|
||||
case .md5:
|
||||
return MD5(NSData()).size
|
||||
}
|
||||
}
|
||||
|
||||
func calculateHash(bytes bytes:[UInt8]) -> [UInt8]? {
|
||||
switch (self) {
|
||||
case .sha1:
|
||||
return NSData.withBytes(bytes).sha1()?.arrayOfBytes()
|
||||
case .sha256:
|
||||
return NSData.withBytes(bytes).sha256()?.arrayOfBytes()
|
||||
case .sha384:
|
||||
return NSData.withBytes(bytes).sha384()?.arrayOfBytes()
|
||||
case .sha512:
|
||||
return NSData.withBytes(bytes).sha512()?.arrayOfBytes()
|
||||
case .md5:
|
||||
return NSData.withBytes(bytes).md5()?.arrayOfBytes();
|
||||
}
|
||||
}
|
||||
|
||||
func blockSize() -> Int {
|
||||
switch self {
|
||||
case .md5, .sha1, .sha256:
|
||||
return 64
|
||||
case .sha384, .sha512:
|
||||
return 128
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var key:[UInt8]
|
||||
let variant:Variant
|
||||
|
||||
class internal func authenticate(key key: [UInt8], message: [UInt8], variant:HMAC.Variant = .md5) -> [UInt8]? {
|
||||
return HMAC(key, variant: variant)?.authenticate(message: message)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
internal init? (_ key: [UInt8], variant:HMAC.Variant = .md5) {
|
||||
self.variant = variant
|
||||
self.key = key
|
||||
|
||||
if (key.count > variant.blockSize()) {
|
||||
if let hash = variant.calculateHash(bytes: key) {
|
||||
self.key = hash
|
||||
}
|
||||
}
|
||||
|
||||
if (key.count < variant.blockSize()) { // keys shorter than blocksize are zero-padded
|
||||
self.key = key + [UInt8](count: variant.blockSize() - key.count, repeatedValue: 0)
|
||||
}
|
||||
}
|
||||
|
||||
internal func authenticate(message message:[UInt8]) -> [UInt8]? {
|
||||
var opad = [UInt8](count: variant.blockSize(), repeatedValue: 0x5c)
|
||||
for (idx, _) in key.enumerate() {
|
||||
opad[idx] = key[idx] ^ opad[idx]
|
||||
}
|
||||
var ipad = [UInt8](count: variant.blockSize(), repeatedValue: 0x36)
|
||||
for (idx, _) in key.enumerate() {
|
||||
ipad[idx] = key[idx] ^ ipad[idx]
|
||||
}
|
||||
|
||||
var finalHash:[UInt8]? = nil;
|
||||
if let ipadAndMessageHash = variant.calculateHash(bytes: ipad + message) {
|
||||
finalHash = variant.calculateHash(bytes: opad + ipadAndMessageHash);
|
||||
}
|
||||
return finalHash
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// CryptoHash.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 07/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public enum Hash {
|
||||
case md5(NSData)
|
||||
case sha1(NSData)
|
||||
case sha224(NSData), sha256(NSData), sha384(NSData), sha512(NSData)
|
||||
case crc32(NSData)
|
||||
|
||||
public func calculate() -> NSData? {
|
||||
switch self {
|
||||
case md5(let data):
|
||||
return MD5(data).calculate()
|
||||
case sha1(let data):
|
||||
return SHA1(data).calculate()
|
||||
case sha224(let data):
|
||||
return SHA2(data, variant: .sha224).calculate32()
|
||||
case sha256(let data):
|
||||
return SHA2(data, variant: .sha256).calculate32()
|
||||
case sha384(let data):
|
||||
return SHA2(data, variant: .sha384).calculate64()
|
||||
case sha512(let data):
|
||||
return SHA2(data, variant: .sha512).calculate64()
|
||||
case crc32(let data):
|
||||
return CRC().crc32(data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
//
|
||||
// HashProtocol.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 17/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
internal protocol HashProtocol {
|
||||
var message: NSData { get }
|
||||
|
||||
/** Common part for hash calculation. Prepare header data. */
|
||||
func prepare(len:Int) -> NSMutableData
|
||||
}
|
||||
|
||||
extension HashProtocol {
|
||||
|
||||
func prepare(len:Int) -> NSMutableData {
|
||||
let tmpMessage: NSMutableData = NSMutableData(data: self.message)
|
||||
|
||||
// Step 1. Append Padding Bits
|
||||
tmpMessage.appendBytes([0x80]) // append one bit (UInt8 with one bit) to message
|
||||
|
||||
// append "0" bit until message length in bits ≡ 448 (mod 512)
|
||||
var msgLength = tmpMessage.length
|
||||
var counter = 0
|
||||
|
||||
while msgLength % len != (len - 8) {
|
||||
counter++
|
||||
msgLength++
|
||||
}
|
||||
|
||||
let bufZeros = UnsafeMutablePointer<UInt8>(calloc(counter, sizeof(UInt8)))
|
||||
|
||||
tmpMessage.appendBytes(bufZeros, length: counter)
|
||||
|
||||
bufZeros.destroy()
|
||||
bufZeros.dealloc(1)
|
||||
|
||||
return tmpMessage
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.hakore.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.16</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,108 +0,0 @@
|
|||
//
|
||||
// IntExtension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 12/08/14.
|
||||
// Copyright (C) 2014 Marcin Krzyżanowski <marcin.krzyzanowski@gmail.com>
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
//
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
//
|
||||
// - The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required.
|
||||
// - Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
// - This notice may not be removed or altered from any source or binary distribution.
|
||||
|
||||
import Foundation
|
||||
|
||||
/* array of bits */
|
||||
extension Int {
|
||||
init(bits: [Bit]) {
|
||||
self.init(bitPattern: integerFromBitsArray(bits) as UInt)
|
||||
}
|
||||
}
|
||||
|
||||
/* array of bytes */
|
||||
extension Int {
|
||||
/** Array of bytes with optional padding (little-endian) */
|
||||
public func bytes(totalBytes: Int = sizeof(Int)) -> [UInt8] {
|
||||
return arrayOfBytes(self, length: totalBytes)
|
||||
}
|
||||
|
||||
public static func withBytes(bytes: ArraySlice<UInt8>) -> Int {
|
||||
return Int.withBytes(Array(bytes))
|
||||
}
|
||||
|
||||
/** Int with array bytes (little-endian) */
|
||||
public static func withBytes(bytes: [UInt8]) -> Int {
|
||||
return integerWithBytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Shift bits */
|
||||
extension Int {
|
||||
|
||||
/** Shift bits to the left. All bits are shifted (including sign bit) */
|
||||
private mutating func shiftLeft(count: Int) -> Int {
|
||||
self = CryptoSwift.shiftLeft(self, count: count) //FIXME: count:
|
||||
return self
|
||||
}
|
||||
|
||||
/** Shift bits to the right. All bits are shifted (including sign bit) */
|
||||
private mutating func shiftRight(count: Int) -> Int {
|
||||
if (self == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
let bitsCount = sizeofValue(self) * 8
|
||||
|
||||
if (count >= bitsCount) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let maxBitsForValue = Int(floor(log2(Double(self)) + 1))
|
||||
let shiftCount = Swift.min(count, maxBitsForValue - 1)
|
||||
var shiftedValue:Int = 0;
|
||||
|
||||
for bitIdx in 0..<bitsCount {
|
||||
// if bit is set then copy to result and shift left 1
|
||||
let bit = 1 << bitIdx
|
||||
if ((self & bit) == bit) {
|
||||
shiftedValue = shiftedValue | (bit >> shiftCount)
|
||||
}
|
||||
}
|
||||
self = Int(shiftedValue)
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
// Left operator
|
||||
|
||||
/** shift left and assign with bits truncation */
|
||||
public func &<<= (inout lhs: Int, rhs: Int) {
|
||||
lhs.shiftLeft(rhs)
|
||||
}
|
||||
|
||||
/** shift left with bits truncation */
|
||||
public func &<< (lhs: Int, rhs: Int) -> Int {
|
||||
var l = lhs;
|
||||
l.shiftLeft(rhs)
|
||||
return l
|
||||
}
|
||||
|
||||
// Right operator
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>>= (inout lhs: Int, rhs: Int) {
|
||||
lhs.shiftRight(rhs)
|
||||
}
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>> (lhs: Int, rhs: Int) -> Int {
|
||||
var l = lhs;
|
||||
l.shiftRight(rhs)
|
||||
return l
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// IntegerConvertible.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/06/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol BitshiftOperationsType {
|
||||
func <<(lhs: Self, rhs: Self) -> Self
|
||||
func >>(lhs: Self, rhs: Self) -> Self
|
||||
func <<=(inout lhs: Self, rhs: Self)
|
||||
func >>=(inout lhs: Self, rhs: Self)
|
||||
}
|
||||
|
||||
protocol ByteConvertible {
|
||||
init(_ value: UInt8)
|
||||
init(truncatingBitPattern: UInt64)
|
||||
}
|
||||
|
||||
extension Int : BitshiftOperationsType, ByteConvertible { }
|
||||
extension Int8 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension Int16 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension Int32 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension Int64 : BitshiftOperationsType, ByteConvertible {
|
||||
init(truncatingBitPattern value: UInt64) {
|
||||
self = Int64(bitPattern: value)
|
||||
}
|
||||
}
|
||||
extension UInt : BitshiftOperationsType, ByteConvertible { }
|
||||
extension UInt8 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension UInt16 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension UInt32 : BitshiftOperationsType, ByteConvertible { }
|
||||
extension UInt64 : BitshiftOperationsType, ByteConvertible {
|
||||
init(truncatingBitPattern value: UInt64) {
|
||||
self = value
|
||||
}
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
//
|
||||
// MD5.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 06/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class MD5 : HashProtocol {
|
||||
var size:Int = 16 // 128 / 8
|
||||
let message: NSData
|
||||
|
||||
init (_ message: NSData) {
|
||||
self.message = message
|
||||
}
|
||||
|
||||
/** specifies the per-round shift amounts */
|
||||
private let s: [UInt32] = [7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22,
|
||||
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20,
|
||||
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23,
|
||||
6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]
|
||||
|
||||
/** binary integer part of the sines of integers (Radians) */
|
||||
private let k: [UInt32] = [0xd76aa478,0xe8c7b756,0x242070db,0xc1bdceee,
|
||||
0xf57c0faf,0x4787c62a,0xa8304613,0xfd469501,
|
||||
0x698098d8,0x8b44f7af,0xffff5bb1,0x895cd7be,
|
||||
0x6b901122,0xfd987193,0xa679438e,0x49b40821,
|
||||
0xf61e2562,0xc040b340,0x265e5a51,0xe9b6c7aa,
|
||||
0xd62f105d,0x2441453,0xd8a1e681,0xe7d3fbc8,
|
||||
0x21e1cde6,0xc33707d6,0xf4d50d87,0x455a14ed,
|
||||
0xa9e3e905,0xfcefa3f8,0x676f02d9,0x8d2a4c8a,
|
||||
0xfffa3942,0x8771f681,0x6d9d6122,0xfde5380c,
|
||||
0xa4beea44,0x4bdecfa9,0xf6bb4b60,0xbebfbc70,
|
||||
0x289b7ec6,0xeaa127fa,0xd4ef3085,0x4881d05,
|
||||
0xd9d4d039,0xe6db99e5,0x1fa27cf8,0xc4ac5665,
|
||||
0xf4292244,0x432aff97,0xab9423a7,0xfc93a039,
|
||||
0x655b59c3,0x8f0ccc92,0xffeff47d,0x85845dd1,
|
||||
0x6fa87e4f,0xfe2ce6e0,0xa3014314,0x4e0811a1,
|
||||
0xf7537e82,0xbd3af235,0x2ad7d2bb,0xeb86d391]
|
||||
|
||||
private let h:[UInt32] = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]
|
||||
|
||||
func calculate() -> NSData {
|
||||
let tmpMessage = prepare(64)
|
||||
|
||||
// hash values
|
||||
var hh = h
|
||||
|
||||
// Step 2. Append Length a 64-bit representation of lengthInBits
|
||||
let lengthInBits = (message.length * 8)
|
||||
let lengthBytes = lengthInBits.bytes(64 / 8)
|
||||
tmpMessage.appendBytes(Array(lengthBytes.reverse())); //FIXME: Array?
|
||||
|
||||
// Process the message in successive 512-bit chunks:
|
||||
let chunkSizeBytes = 512 / 8 // 64
|
||||
for chunk in NSDataSequence(chunkSize: chunkSizeBytes, data: tmpMessage) {
|
||||
// break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15
|
||||
var M = [UInt32](count: 16, repeatedValue: 0)
|
||||
let range = NSRange(location:0, length: M.count * sizeof(UInt32))
|
||||
chunk.getBytes(UnsafeMutablePointer<Void>(M), range: range)
|
||||
|
||||
// Initialize hash value for this chunk:
|
||||
var A:UInt32 = hh[0]
|
||||
var B:UInt32 = hh[1]
|
||||
var C:UInt32 = hh[2]
|
||||
var D:UInt32 = hh[3]
|
||||
|
||||
var dTemp:UInt32 = 0
|
||||
|
||||
// Main loop
|
||||
for j in 0..<k.count {
|
||||
var g = 0
|
||||
var F:UInt32 = 0
|
||||
|
||||
switch (j) {
|
||||
case 0...15:
|
||||
F = (B & C) | ((~B) & D)
|
||||
g = j
|
||||
break
|
||||
case 16...31:
|
||||
F = (D & B) | (~D & C)
|
||||
g = (5 * j + 1) % 16
|
||||
break
|
||||
case 32...47:
|
||||
F = B ^ C ^ D
|
||||
g = (3 * j + 5) % 16
|
||||
break
|
||||
case 48...63:
|
||||
F = C ^ (B | (~D))
|
||||
g = (7 * j) % 16
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
dTemp = D
|
||||
D = C
|
||||
C = B
|
||||
B = B &+ rotateLeft((A &+ F &+ k[j] &+ M[g]), n: s[j])
|
||||
A = dTemp
|
||||
}
|
||||
|
||||
hh[0] = hh[0] &+ A
|
||||
hh[1] = hh[1] &+ B
|
||||
hh[2] = hh[2] &+ C
|
||||
hh[3] = hh[3] &+ D
|
||||
}
|
||||
|
||||
let buf: NSMutableData = NSMutableData();
|
||||
hh.forEach({ (item) -> () in
|
||||
var i:UInt32 = item.littleEndian
|
||||
buf.appendBytes(&i, length: sizeofValue(i))
|
||||
})
|
||||
|
||||
return buf.copy() as! NSData
|
||||
}
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
//
|
||||
// PGPDataExtension.swift
|
||||
// SwiftPGP
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 05/07/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension NSMutableData {
|
||||
|
||||
/** Convenient way to append bytes */
|
||||
internal func appendBytes(arrayOfBytes: [UInt8]) {
|
||||
self.appendBytes(arrayOfBytes, length: arrayOfBytes.count)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension NSData {
|
||||
|
||||
public func checksum() -> UInt16 {
|
||||
var s:UInt32 = 0;
|
||||
|
||||
var bytesArray = self.arrayOfBytes()
|
||||
|
||||
for (var i = 0; i < bytesArray.count; i++) {
|
||||
_ = bytesArray[i]
|
||||
s = s + UInt32(bytesArray[i])
|
||||
}
|
||||
s = s % 65536;
|
||||
return UInt16(s);
|
||||
}
|
||||
|
||||
@nonobjc public func md5() -> NSData? {
|
||||
return Hash.md5(self).calculate()
|
||||
}
|
||||
|
||||
public func sha1() -> NSData? {
|
||||
return Hash.sha1(self).calculate()
|
||||
}
|
||||
|
||||
public func sha224() -> NSData? {
|
||||
return Hash.sha224(self).calculate()
|
||||
}
|
||||
|
||||
public func sha256() -> NSData? {
|
||||
return Hash.sha256(self).calculate()
|
||||
}
|
||||
|
||||
public func sha384() -> NSData? {
|
||||
return Hash.sha384(self).calculate()
|
||||
}
|
||||
|
||||
public func sha512() -> NSData? {
|
||||
return Hash.sha512(self).calculate()
|
||||
}
|
||||
|
||||
public func crc32() -> NSData? {
|
||||
return Hash.crc32(self).calculate()
|
||||
}
|
||||
|
||||
public func encrypt(cipher: Cipher) throws -> NSData? {
|
||||
let encrypted = try cipher.encrypt(self.arrayOfBytes())
|
||||
return NSData.withBytes(encrypted)
|
||||
}
|
||||
|
||||
public func decrypt(cipher: Cipher) throws -> NSData? {
|
||||
let decrypted = try cipher.decrypt(self.arrayOfBytes())
|
||||
return NSData.withBytes(decrypted)
|
||||
}
|
||||
|
||||
public func authenticate(authenticator: Authenticator) -> NSData? {
|
||||
if let result = authenticator.authenticate(self.arrayOfBytes()) {
|
||||
return NSData.withBytes(result)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
extension NSData {
|
||||
|
||||
public func toHexString() -> String {
|
||||
let count = self.length / sizeof(UInt8)
|
||||
var bytesArray = [UInt8](count: count, repeatedValue: 0)
|
||||
self.getBytes(&bytesArray, length:count * sizeof(UInt8))
|
||||
|
||||
var s:String = "";
|
||||
for byte in bytesArray {
|
||||
s = s + String(format:"%02x", byte)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
public func arrayOfBytes() -> [UInt8] {
|
||||
let count = self.length / sizeof(UInt8)
|
||||
var bytesArray = [UInt8](count: count, repeatedValue: 0)
|
||||
self.getBytes(&bytesArray, length:count * sizeof(UInt8))
|
||||
return bytesArray
|
||||
}
|
||||
|
||||
class public func withBytes(bytes: [UInt8]) -> NSData {
|
||||
return NSData(bytes: bytes, length: bytes.count)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
//
|
||||
// NSDataSequence.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 15/07/15.
|
||||
// Copyright © 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct NSDataSequence: SequenceType {
|
||||
|
||||
let chunkSize: Int
|
||||
let data: NSData
|
||||
|
||||
func generate() -> AnyGenerator<NSData> {
|
||||
|
||||
var offset:Int = 0
|
||||
|
||||
return anyGenerator {
|
||||
let result = self.data.subdataWithRange(NSRange(location: offset, length: min(self.chunkSize, self.data.length - offset)))
|
||||
offset += result.length
|
||||
return result.length > 0 ? result : nil
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
//
|
||||
// Operators.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
/*
|
||||
Bit shifting with overflow protection using overflow operator "&".
|
||||
Approach is consistent with standard overflow operators &+, &-, &*, &/
|
||||
and introduce new overflow operators for shifting: &<<, &>>
|
||||
|
||||
Note: Works with unsigned integers values only
|
||||
|
||||
Usage
|
||||
|
||||
var i = 1 // init
|
||||
var j = i &<< 2 //shift left
|
||||
j &<<= 2 //shift left and assign
|
||||
|
||||
|
||||
@see: https://medium.com/@krzyzanowskim/swiftly-shift-bits-and-protect-yourself-be33016ce071
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
|
||||
infix operator &<<= {
|
||||
associativity none
|
||||
precedence 160
|
||||
}
|
||||
|
||||
infix operator &<< {
|
||||
associativity none
|
||||
precedence 160
|
||||
}
|
||||
|
||||
infix operator &>>= {
|
||||
associativity none
|
||||
precedence 160
|
||||
}
|
||||
|
||||
infix operator &>> {
|
||||
associativity none
|
||||
precedence 160
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
//
|
||||
// PKCS.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 12/03/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
// PKCS is a group of public-key cryptography standards devised
|
||||
// and published by RSA Security Inc, starting in the early 1990s.
|
||||
//
|
||||
// PKCS#5 http://tools.ietf.org/html/rfc2898
|
||||
|
||||
import Foundation
|
||||
|
||||
//public struct PKCS5 {
|
||||
//}
|
||||
//
|
||||
//extension PKCS5 {
|
||||
// //
|
||||
// // PBKDF2 - Password-Based Key Derivation Function 2. Key stretching technique.
|
||||
// // DK = PBKDF2(PRF, Password, Salt, c, dkLen)
|
||||
// //
|
||||
// struct PBKDF2 {
|
||||
// typealias Bytes = [UInt8]
|
||||
// private func calc(# hash:Hash, password:Bytes, salt:Bytes, c:Int, dkLen:Int) -> [UInt8]? {
|
||||
// if (dkLen > Int(pow(2,32) as Float - 1)) {
|
||||
// println("ERROR: derived key too long");
|
||||
// return nil
|
||||
// }
|
||||
//
|
||||
// if let prf = HMAC(password, variant: .sha256) { //FIXME: hardcoded SHA256
|
||||
// let hLen = prf.variant.size
|
||||
// let numBlocks = Int(ceilf(Float(dkLen) / Float(hLen))) // l
|
||||
// let lastBlockOctets = dkLen - (1 - numBlocks) * hLen // r
|
||||
// // blocks
|
||||
// for block in 1...numBlocks {
|
||||
// // for each block T_i = U_1 ^ U_2 ^ ... ^ U_iter
|
||||
// // U_1 = PRF(password, salt || uint(i))
|
||||
// var uinti = [UInt8](count: 4, repeatedValue: 0)
|
||||
// uinti[0] = UInt8(block >> 24)
|
||||
// uinti[1] = UInt8(block >> 16)
|
||||
// uinti[2] = UInt8(block >> 8)
|
||||
// uinti[3] = UInt8(block)
|
||||
// if let dk = prf.authenticate(message: salt + uinti) {
|
||||
// let T = dk[dk.count - hLen]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return nil
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -1,46 +0,0 @@
|
|||
//
|
||||
// PKCS7.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 28/02/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
// PKCS is a group of public-key cryptography standards devised
|
||||
// and published by RSA Security Inc, starting in the early 1990s.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct PKCS7: Padding {
|
||||
|
||||
public init() {
|
||||
|
||||
}
|
||||
|
||||
public func add(bytes: [UInt8] , blockSize:Int) -> [UInt8] {
|
||||
let padding = UInt8(blockSize - (bytes.count % blockSize))
|
||||
var withPadding = bytes
|
||||
if (padding == 0) {
|
||||
// If the original data is a multiple of N bytes, then an extra block of bytes with value N is added.
|
||||
for _ in 0..<blockSize {
|
||||
withPadding.appendContentsOf([UInt8(blockSize)])
|
||||
}
|
||||
} else {
|
||||
// The value of each added byte is the number of bytes that are added
|
||||
for _ in 0..<padding {
|
||||
withPadding.appendContentsOf([UInt8(padding)])
|
||||
}
|
||||
}
|
||||
return withPadding
|
||||
}
|
||||
|
||||
public func remove(bytes: [UInt8], blockSize:Int?) -> [UInt8] {
|
||||
let lastByte = bytes.last!
|
||||
let padding = Int(lastByte) // last byte
|
||||
|
||||
if padding >= 1 { //TODO: need test for that, what about empty padding
|
||||
return Array(bytes[0..<(bytes.count - padding)])
|
||||
}
|
||||
return bytes
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// Padding.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/02/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol Padding {
|
||||
func add(data: [UInt8], blockSize:Int) -> [UInt8]
|
||||
func remove(data: [UInt8], blockSize:Int?) -> [UInt8]
|
||||
}
|
|
@ -1,305 +0,0 @@
|
|||
//
|
||||
// Poly1305.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 30/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
// http://tools.ietf.org/html/draft-agl-tls-chacha20poly1305-04#section-4
|
||||
//
|
||||
// Poly1305 takes a 32-byte, one-time key and a message and produces a 16-byte tag that authenticates the
|
||||
// message such that an attacker has a negligible chance of producing a valid tag for an inauthentic message.
|
||||
|
||||
import Foundation
|
||||
|
||||
final public class Poly1305 {
|
||||
let blockSize = 16
|
||||
private var ctx:Context?
|
||||
|
||||
private class Context {
|
||||
var r = [UInt8](count: 17, repeatedValue: 0)
|
||||
var h = [UInt8](count: 17, repeatedValue: 0)
|
||||
var pad = [UInt8](count: 17, repeatedValue: 0)
|
||||
var buffer = [UInt8](count: 16, repeatedValue: 0)
|
||||
|
||||
var final:UInt8 = 0
|
||||
var leftover:Int = 0
|
||||
|
||||
init?(_ key: [UInt8]) {
|
||||
assert(key.count == 32,"Invalid key length");
|
||||
if (key.count != 32) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
for i in 0..<17 {
|
||||
h[i] = 0
|
||||
}
|
||||
|
||||
r[0] = key[0] & 0xff;
|
||||
r[1] = key[1] & 0xff;
|
||||
r[2] = key[2] & 0xff;
|
||||
r[3] = key[3] & 0x0f;
|
||||
r[4] = key[4] & 0xfc;
|
||||
r[5] = key[5] & 0xff;
|
||||
r[6] = key[6] & 0xff;
|
||||
r[7] = key[7] & 0x0f;
|
||||
r[8] = key[8] & 0xfc;
|
||||
r[9] = key[9] & 0xff;
|
||||
r[10] = key[10] & 0xff;
|
||||
r[11] = key[11] & 0x0f;
|
||||
r[12] = key[12] & 0xfc;
|
||||
r[13] = key[13] & 0xff;
|
||||
r[14] = key[14] & 0xff;
|
||||
r[15] = key[15] & 0x0f;
|
||||
r[16] = 0
|
||||
|
||||
for i in 0..<16 {
|
||||
pad[i] = key[i + 16]
|
||||
}
|
||||
pad[16] = 0
|
||||
|
||||
leftover = 0
|
||||
final = 0
|
||||
}
|
||||
|
||||
deinit {
|
||||
for i in 0..<buffer.count {
|
||||
buffer[i] = 0
|
||||
}
|
||||
|
||||
for i in 0..<r.count {
|
||||
r[i] = 0
|
||||
h[i] = 0
|
||||
pad[i] = 0
|
||||
final = 0
|
||||
leftover = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Internal
|
||||
|
||||
/**
|
||||
Calculate Message Authentication Code (MAC) for message.
|
||||
Calculation context is discarder on instance deallocation.
|
||||
|
||||
- parameter key: 256-bit key
|
||||
- parameter message: Message
|
||||
|
||||
- returns: Message Authentication Code
|
||||
*/
|
||||
class internal func authenticate(key key: [UInt8], message: [UInt8]) -> [UInt8]? {
|
||||
return Poly1305(key)?.authenticate(message: message)
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private init? (_ key: [UInt8]) {
|
||||
ctx = Context(key)
|
||||
if (ctx == nil) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private func authenticate(message message:[UInt8]) -> [UInt8]? {
|
||||
if let ctx = self.ctx {
|
||||
update(ctx, message: message)
|
||||
return finish(ctx)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
/**
|
||||
Add message to be processed
|
||||
|
||||
- parameter context: Context
|
||||
- parameter message: message
|
||||
- parameter bytes: length of the message fragment to be processed
|
||||
*/
|
||||
private func update(context:Context, message:[UInt8], bytes:Int? = nil) {
|
||||
var bytes = bytes ?? message.count
|
||||
var mPos = 0
|
||||
|
||||
/* handle leftover */
|
||||
if (context.leftover > 0) {
|
||||
var want = blockSize - context.leftover
|
||||
if (want > bytes) {
|
||||
want = bytes
|
||||
}
|
||||
|
||||
for i in 0..<want {
|
||||
context.buffer[context.leftover + i] = message[mPos + i]
|
||||
}
|
||||
|
||||
bytes -= want
|
||||
mPos += want
|
||||
context.leftover += want
|
||||
|
||||
if (context.leftover < blockSize) {
|
||||
return
|
||||
}
|
||||
|
||||
blocks(context, m: context.buffer)
|
||||
context.leftover = 0
|
||||
}
|
||||
|
||||
/* process full blocks */
|
||||
if (bytes >= blockSize) {
|
||||
let want = bytes & ~(blockSize - 1)
|
||||
blocks(context, m: message, startPos: mPos)
|
||||
mPos += want
|
||||
bytes -= want;
|
||||
}
|
||||
|
||||
/* store leftover */
|
||||
if (bytes > 0) {
|
||||
for i in 0..<bytes {
|
||||
context.buffer[context.leftover + i] = message[mPos + i]
|
||||
}
|
||||
|
||||
context.leftover += bytes
|
||||
}
|
||||
}
|
||||
|
||||
private func finish(context:Context) -> [UInt8]? {
|
||||
var mac = [UInt8](count: 16, repeatedValue: 0);
|
||||
|
||||
/* process the remaining block */
|
||||
if (context.leftover > 0) {
|
||||
|
||||
var i = context.leftover
|
||||
context.buffer[i++] = 1
|
||||
for (; i < blockSize; i++) {
|
||||
context.buffer[i] = 0
|
||||
}
|
||||
context.final = 1
|
||||
|
||||
blocks(context, m: context.buffer)
|
||||
}
|
||||
|
||||
|
||||
/* fully reduce h */
|
||||
freeze(context)
|
||||
|
||||
/* h = (h + pad) % (1 << 128) */
|
||||
add(context, c: context.pad)
|
||||
for i in 0..<mac.count {
|
||||
mac[i] = context.h[i]
|
||||
}
|
||||
|
||||
return mac
|
||||
}
|
||||
|
||||
// MARK: - Utils
|
||||
|
||||
private func add(context:Context, c:[UInt8]) -> Bool {
|
||||
if (context.h.count != 17 && c.count != 17) {
|
||||
return false
|
||||
}
|
||||
|
||||
var u:UInt16 = 0
|
||||
for i in 0..<17 {
|
||||
u += UInt16(context.h[i]) + UInt16(c[i])
|
||||
context.h[i] = UInt8.withValue(u)
|
||||
u = u >> 8
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private func squeeze(context:Context, hr:[UInt32]) -> Bool {
|
||||
if (context.h.count != 17 && hr.count != 17) {
|
||||
return false
|
||||
}
|
||||
|
||||
var u:UInt32 = 0
|
||||
|
||||
for i in 0..<16 {
|
||||
u += hr[i];
|
||||
context.h[i] = UInt8.withValue(u) // crash! h[i] = UInt8(u) & 0xff
|
||||
u >>= 8;
|
||||
}
|
||||
|
||||
u += hr[16]
|
||||
context.h[16] = UInt8.withValue(u) & 0x03
|
||||
u >>= 2
|
||||
u += (u << 2); /* u *= 5; */
|
||||
for i in 0..<16 {
|
||||
u += UInt32(context.h[i])
|
||||
context.h[i] = UInt8.withValue(u) // crash! h[i] = UInt8(u) & 0xff
|
||||
u >>= 8
|
||||
}
|
||||
context.h[16] += UInt8.withValue(u);
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private func freeze(context:Context) -> Bool {
|
||||
assert(context.h.count == 17,"Invalid length")
|
||||
if (context.h.count != 17) {
|
||||
return false
|
||||
}
|
||||
|
||||
let minusp:[UInt8] = [0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc]
|
||||
var horig:[UInt8] = [UInt8](count: 17, repeatedValue: 0)
|
||||
|
||||
/* compute h + -p */
|
||||
for i in 0..<17 {
|
||||
horig[i] = context.h[i]
|
||||
}
|
||||
|
||||
add(context, c: minusp)
|
||||
|
||||
/* select h if h < p, or h + -p if h >= p */
|
||||
let bits:[Bit] = (context.h[16] >> 7).bits()
|
||||
let invertedBits = bits.map({ (bit) -> Bit in
|
||||
return bit.inverted()
|
||||
})
|
||||
|
||||
let negative = UInt8(bits: invertedBits)
|
||||
for i in 0..<17 {
|
||||
context.h[i] ^= negative & (horig[i] ^ context.h[i]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private func blocks(context:Context, m:[UInt8], startPos:Int = 0) -> Int {
|
||||
var bytes = m.count
|
||||
let hibit = context.final ^ 1 // 1 <<128
|
||||
var mPos = startPos
|
||||
|
||||
while (bytes >= Int(blockSize)) {
|
||||
var hr:[UInt32] = [UInt32](count: 17, repeatedValue: 0)
|
||||
var u:UInt32 = 0
|
||||
var c:[UInt8] = [UInt8](count: 17, repeatedValue: 0)
|
||||
|
||||
/* h += m */
|
||||
for i in 0..<16 {
|
||||
c[i] = m[mPos + i]
|
||||
}
|
||||
c[16] = hibit
|
||||
|
||||
add(context, c: c)
|
||||
|
||||
/* h *= r */
|
||||
for i in 0..<17 {
|
||||
u = 0
|
||||
for j in 0...i {
|
||||
u = u + UInt32(UInt16(context.h[j])) * UInt32(context.r[i - j]) // u += (unsigned short)st->h[j] * st->r[i - j];
|
||||
}
|
||||
for j in (i+1)..<17 {
|
||||
var v:UInt32 = UInt32(UInt16(context.h[j])) * UInt32(context.r[i + 17 - j]) // unsigned long v = (unsigned short)st->h[j] * st->r[i + 17 - j];
|
||||
v = ((v << 8) &+ (v << 6))
|
||||
u = u &+ v
|
||||
}
|
||||
hr[i] = u
|
||||
}
|
||||
|
||||
squeeze(context, hr: hr)
|
||||
|
||||
mPos += blockSize
|
||||
bytes -= blockSize
|
||||
}
|
||||
return mPos
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
//
|
||||
// SHA1.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 16/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
final class SHA1 : HashProtocol {
|
||||
var size:Int = 20 // 160 / 8
|
||||
let message: NSData
|
||||
|
||||
init(_ message: NSData) {
|
||||
self.message = message
|
||||
}
|
||||
|
||||
private let h:[UInt32] = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
|
||||
|
||||
func calculate() -> NSData {
|
||||
let tmpMessage = self.prepare(64)
|
||||
|
||||
// hash values
|
||||
var hh = h
|
||||
|
||||
// append message length, in a 64-bit big-endian integer. So now the message length is a multiple of 512 bits.
|
||||
tmpMessage.appendBytes((self.message.length * 8).bytes(64 / 8));
|
||||
|
||||
// Process the message in successive 512-bit chunks:
|
||||
let chunkSizeBytes = 512 / 8 // 64
|
||||
for chunk in NSDataSequence(chunkSize: chunkSizeBytes, data: tmpMessage) {
|
||||
// break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15, big-endian
|
||||
// Extend the sixteen 32-bit words into eighty 32-bit words:
|
||||
var M:[UInt32] = [UInt32](count: 80, repeatedValue: 0)
|
||||
for x in 0..<M.count {
|
||||
switch (x) {
|
||||
case 0...15:
|
||||
var le:UInt32 = 0
|
||||
chunk.getBytes(&le, range:NSRange(location:x * sizeofValue(M[x]), length: sizeofValue(M[x])));
|
||||
M[x] = le.bigEndian
|
||||
break
|
||||
default:
|
||||
M[x] = rotateLeft(M[x-3] ^ M[x-8] ^ M[x-14] ^ M[x-16], n: 1) //FIXME: n:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var A = hh[0]
|
||||
var B = hh[1]
|
||||
var C = hh[2]
|
||||
var D = hh[3]
|
||||
var E = hh[4]
|
||||
|
||||
// Main loop
|
||||
for j in 0...79 {
|
||||
var f: UInt32 = 0;
|
||||
var k: UInt32 = 0
|
||||
|
||||
switch (j) {
|
||||
case 0...19:
|
||||
f = (B & C) | ((~B) & D)
|
||||
k = 0x5A827999
|
||||
break
|
||||
case 20...39:
|
||||
f = B ^ C ^ D
|
||||
k = 0x6ED9EBA1
|
||||
break
|
||||
case 40...59:
|
||||
f = (B & C) | (B & D) | (C & D)
|
||||
k = 0x8F1BBCDC
|
||||
break
|
||||
case 60...79:
|
||||
f = B ^ C ^ D
|
||||
k = 0xCA62C1D6
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
let temp = (rotateLeft(A,n: 5) &+ f &+ E &+ M[j] &+ k) & 0xffffffff
|
||||
E = D
|
||||
D = C
|
||||
C = rotateLeft(B, n: 30)
|
||||
B = A
|
||||
A = temp
|
||||
}
|
||||
|
||||
hh[0] = (hh[0] &+ A) & 0xffffffff
|
||||
hh[1] = (hh[1] &+ B) & 0xffffffff
|
||||
hh[2] = (hh[2] &+ C) & 0xffffffff
|
||||
hh[3] = (hh[3] &+ D) & 0xffffffff
|
||||
hh[4] = (hh[4] &+ E) & 0xffffffff
|
||||
}
|
||||
|
||||
// Produce the final hash value (big-endian) as a 160 bit number:
|
||||
let buf: NSMutableData = NSMutableData();
|
||||
for item in hh {
|
||||
var i:UInt32 = item.bigEndian
|
||||
buf.appendBytes(&i, length: sizeofValue(i))
|
||||
}
|
||||
|
||||
return buf.copy() as! NSData;
|
||||
}
|
||||
}
|
|
@ -1,287 +0,0 @@
|
|||
//
|
||||
// SHA2.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 24/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
final class SHA2 : HashProtocol {
|
||||
var size:Int { return variant.rawValue }
|
||||
let variant:SHA2.Variant
|
||||
|
||||
let message: NSData
|
||||
|
||||
init(_ message:NSData, variant: SHA2.Variant) {
|
||||
self.variant = variant
|
||||
self.message = message
|
||||
}
|
||||
|
||||
enum Variant: RawRepresentable {
|
||||
case sha224, sha256, sha384, sha512
|
||||
|
||||
typealias RawValue = Int
|
||||
var rawValue: RawValue {
|
||||
switch (self) {
|
||||
case .sha224:
|
||||
return 224
|
||||
case .sha256:
|
||||
return 256
|
||||
case .sha384:
|
||||
return 384
|
||||
case .sha512:
|
||||
return 512
|
||||
}
|
||||
}
|
||||
|
||||
init?(rawValue: RawValue) {
|
||||
switch (rawValue) {
|
||||
case 224:
|
||||
self = .sha224
|
||||
break;
|
||||
case 256:
|
||||
self = .sha256
|
||||
break;
|
||||
case 384:
|
||||
self = .sha384
|
||||
break;
|
||||
case 512:
|
||||
self = .sha512
|
||||
break;
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
var size:Int { return self.rawValue }
|
||||
|
||||
private var h:[UInt64] {
|
||||
switch (self) {
|
||||
case .sha224:
|
||||
return [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]
|
||||
case .sha256:
|
||||
return [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]
|
||||
case .sha384:
|
||||
return [0xcbbb9d5dc1059ed8, 0x629a292a367cd507, 0x9159015a3070dd17, 0x152fecd8f70e5939, 0x67332667ffc00b31, 0x8eb44a8768581511, 0xdb0c2e0d64f98fa7, 0x47b5481dbefa4fa4]
|
||||
case .sha512:
|
||||
return [0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1, 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179]
|
||||
}
|
||||
}
|
||||
|
||||
private var k:[UInt64] {
|
||||
switch (self) {
|
||||
case .sha224, .sha256:
|
||||
return [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]
|
||||
case .sha384, .sha512:
|
||||
return [0x428a2f98d728ae22, 0x7137449123ef65cd, 0xb5c0fbcfec4d3b2f, 0xe9b5dba58189dbbc, 0x3956c25bf348b538,
|
||||
0x59f111f1b605d019, 0x923f82a4af194f9b, 0xab1c5ed5da6d8118, 0xd807aa98a3030242, 0x12835b0145706fbe,
|
||||
0x243185be4ee4b28c, 0x550c7dc3d5ffb4e2, 0x72be5d74f27b896f, 0x80deb1fe3b1696b1, 0x9bdc06a725c71235,
|
||||
0xc19bf174cf692694, 0xe49b69c19ef14ad2, 0xefbe4786384f25e3, 0x0fc19dc68b8cd5b5, 0x240ca1cc77ac9c65,
|
||||
0x2de92c6f592b0275, 0x4a7484aa6ea6e483, 0x5cb0a9dcbd41fbd4, 0x76f988da831153b5, 0x983e5152ee66dfab,
|
||||
0xa831c66d2db43210, 0xb00327c898fb213f, 0xbf597fc7beef0ee4, 0xc6e00bf33da88fc2, 0xd5a79147930aa725,
|
||||
0x06ca6351e003826f, 0x142929670a0e6e70, 0x27b70a8546d22ffc, 0x2e1b21385c26c926, 0x4d2c6dfc5ac42aed,
|
||||
0x53380d139d95b3df, 0x650a73548baf63de, 0x766a0abb3c77b2a8, 0x81c2c92e47edaee6, 0x92722c851482353b,
|
||||
0xa2bfe8a14cf10364, 0xa81a664bbc423001, 0xc24b8b70d0f89791, 0xc76c51a30654be30, 0xd192e819d6ef5218,
|
||||
0xd69906245565a910, 0xf40e35855771202a, 0x106aa07032bbd1b8, 0x19a4c116b8d2d0c8, 0x1e376c085141ab53,
|
||||
0x2748774cdf8eeb99, 0x34b0bcb5e19b48a8, 0x391c0cb3c5c95a63, 0x4ed8aa4ae3418acb, 0x5b9cca4f7763e373,
|
||||
0x682e6ff3d6b2b8a3, 0x748f82ee5defb2fc, 0x78a5636f43172f60, 0x84c87814a1f0ab72, 0x8cc702081a6439ec,
|
||||
0x90befffa23631e28, 0xa4506cebde82bde9, 0xbef9a3f7b2c67915, 0xc67178f2e372532b, 0xca273eceea26619c,
|
||||
0xd186b8c721c0c207, 0xeada7dd6cde0eb1e, 0xf57d4f7fee6ed178, 0x06f067aa72176fba, 0x0a637dc5a2c898a6,
|
||||
0x113f9804bef90dae, 0x1b710b35131c471b, 0x28db77f523047d84, 0x32caab7b40c72493, 0x3c9ebe0a15c9bebc,
|
||||
0x431d67c49c100d4c, 0x4cc5d4becb3e42b6, 0x597f299cfc657e2a, 0x5fcb6fab3ad6faec, 0x6c44198c4a475817]
|
||||
}
|
||||
}
|
||||
|
||||
private func resultingArray<T>(hh:[T]) -> [T] {
|
||||
var finalHH:[T] = hh;
|
||||
switch (self) {
|
||||
case .sha224:
|
||||
finalHH = Array(hh[0..<7])
|
||||
break;
|
||||
case .sha384:
|
||||
finalHH = Array(hh[0..<6])
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return finalHH
|
||||
}
|
||||
}
|
||||
|
||||
//FIXME: I can't do Generic func out of calculate32 and calculate64 (UInt32 vs UInt64), but if you can - please do pull request.
|
||||
func calculate32() -> NSData {
|
||||
let tmpMessage = self.prepare(64)
|
||||
|
||||
// hash values
|
||||
var hh = [UInt32]()
|
||||
variant.h.forEach {(h) -> () in
|
||||
hh.append(UInt32(h))
|
||||
}
|
||||
|
||||
// append message length, in a 64-bit big-endian integer. So now the message length is a multiple of 512 bits.
|
||||
tmpMessage.appendBytes((message.length * 8).bytes(64 / 8));
|
||||
|
||||
// Process the message in successive 512-bit chunks:
|
||||
let chunkSizeBytes = 512 / 8 // 64
|
||||
for chunk in NSDataSequence(chunkSize: chunkSizeBytes, data: tmpMessage) {
|
||||
// break chunk into sixteen 32-bit words M[j], 0 ≤ j ≤ 15, big-endian
|
||||
// Extend the sixteen 32-bit words into sixty-four 32-bit words:
|
||||
var M:[UInt32] = [UInt32](count: variant.k.count, repeatedValue: 0)
|
||||
for x in 0..<M.count {
|
||||
switch (x) {
|
||||
case 0...15:
|
||||
var le:UInt32 = 0
|
||||
chunk.getBytes(&le, range:NSRange(location:x * sizeofValue(le), length: sizeofValue(le)));
|
||||
M[x] = le.bigEndian
|
||||
break
|
||||
default:
|
||||
let s0 = rotateRight(M[x-15], n: 7) ^ rotateRight(M[x-15], n: 18) ^ (M[x-15] >> 3) //FIXME: n
|
||||
let s1 = rotateRight(M[x-2], n: 17) ^ rotateRight(M[x-2], n: 19) ^ (M[x-2] >> 10)
|
||||
M[x] = M[x-16] &+ s0 &+ M[x-7] &+ s1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var A = hh[0]
|
||||
var B = hh[1]
|
||||
var C = hh[2]
|
||||
var D = hh[3]
|
||||
var E = hh[4]
|
||||
var F = hh[5]
|
||||
var G = hh[6]
|
||||
var H = hh[7]
|
||||
|
||||
// Main loop
|
||||
for j in 0..<variant.k.count {
|
||||
let s0 = rotateRight(A,n: 2) ^ rotateRight(A,n: 13) ^ rotateRight(A,n: 22)
|
||||
let maj = (A & B) ^ (A & C) ^ (B & C)
|
||||
let t2 = s0 &+ maj
|
||||
let s1 = rotateRight(E,n: 6) ^ rotateRight(E,n: 11) ^ rotateRight(E,n: 25)
|
||||
let ch = (E & F) ^ ((~E) & G)
|
||||
let t1 = H &+ s1 &+ ch &+ UInt32(variant.k[j]) &+ M[j]
|
||||
|
||||
H = G
|
||||
G = F
|
||||
F = E
|
||||
E = D &+ t1
|
||||
D = C
|
||||
C = B
|
||||
B = A
|
||||
A = t1 &+ t2
|
||||
}
|
||||
|
||||
hh[0] = (hh[0] &+ A)
|
||||
hh[1] = (hh[1] &+ B)
|
||||
hh[2] = (hh[2] &+ C)
|
||||
hh[3] = (hh[3] &+ D)
|
||||
hh[4] = (hh[4] &+ E)
|
||||
hh[5] = (hh[5] &+ F)
|
||||
hh[6] = (hh[6] &+ G)
|
||||
hh[7] = (hh[7] &+ H)
|
||||
}
|
||||
|
||||
// Produce the final hash value (big-endian) as a 160 bit number:
|
||||
let buf: NSMutableData = NSMutableData();
|
||||
variant.resultingArray(hh).forEach{ (item) -> () in
|
||||
var i:UInt32 = UInt32(item.bigEndian)
|
||||
buf.appendBytes(&i, length: sizeofValue(i))
|
||||
}
|
||||
|
||||
return buf.copy() as! NSData;
|
||||
}
|
||||
|
||||
func calculate64() -> NSData {
|
||||
let tmpMessage = self.prepare(128)
|
||||
|
||||
// hash values
|
||||
var hh = [UInt64]()
|
||||
variant.h.forEach {(h) -> () in
|
||||
hh.append(h)
|
||||
}
|
||||
|
||||
|
||||
// append message length, in a 64-bit big-endian integer. So now the message length is a multiple of 512 bits.
|
||||
tmpMessage.appendBytes((message.length * 8).bytes(64 / 8));
|
||||
|
||||
// Process the message in successive 1024-bit chunks:
|
||||
let chunkSizeBytes = 1024 / 8 // 128
|
||||
var leftMessageBytes = tmpMessage.length
|
||||
for var i = 0; i < tmpMessage.length; i = i + chunkSizeBytes, leftMessageBytes -= chunkSizeBytes {
|
||||
let chunk = tmpMessage.subdataWithRange(NSRange(location: i, length: min(chunkSizeBytes,leftMessageBytes)))
|
||||
// break chunk into sixteen 64-bit words M[j], 0 ≤ j ≤ 15, big-endian
|
||||
// Extend the sixteen 64-bit words into eighty 64-bit words:
|
||||
var M = [UInt64](count: variant.k.count, repeatedValue: 0)
|
||||
for x in 0..<M.count {
|
||||
switch (x) {
|
||||
case 0...15:
|
||||
var le:UInt64 = 0
|
||||
chunk.getBytes(&le, range:NSRange(location:x * sizeofValue(le), length: sizeofValue(le)));
|
||||
M[x] = le.bigEndian
|
||||
break
|
||||
default:
|
||||
let s0 = rotateRight(M[x-15], n: 1) ^ rotateRight(M[x-15], n: 8) ^ (M[x-15] >> 7)
|
||||
let s1 = rotateRight(M[x-2], n: 19) ^ rotateRight(M[x-2], n: 61) ^ (M[x-2] >> 6)
|
||||
M[x] = M[x-16] &+ s0 &+ M[x-7] &+ s1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var A = hh[0]
|
||||
var B = hh[1]
|
||||
var C = hh[2]
|
||||
var D = hh[3]
|
||||
var E = hh[4]
|
||||
var F = hh[5]
|
||||
var G = hh[6]
|
||||
var H = hh[7]
|
||||
|
||||
// Main loop
|
||||
for j in 0..<variant.k.count {
|
||||
let s0 = rotateRight(A,n: 28) ^ rotateRight(A,n: 34) ^ rotateRight(A,n: 39) //FIXME: n:
|
||||
let maj = (A & B) ^ (A & C) ^ (B & C)
|
||||
let t2 = s0 &+ maj
|
||||
let s1 = rotateRight(E,n: 14) ^ rotateRight(E,n: 18) ^ rotateRight(E,n: 41)
|
||||
let ch = (E & F) ^ ((~E) & G)
|
||||
let t1 = H &+ s1 &+ ch &+ variant.k[j] &+ UInt64(M[j])
|
||||
|
||||
H = G
|
||||
G = F
|
||||
F = E
|
||||
E = D &+ t1
|
||||
D = C
|
||||
C = B
|
||||
B = A
|
||||
A = t1 &+ t2
|
||||
}
|
||||
|
||||
hh[0] = (hh[0] &+ A)
|
||||
hh[1] = (hh[1] &+ B)
|
||||
hh[2] = (hh[2] &+ C)
|
||||
hh[3] = (hh[3] &+ D)
|
||||
hh[4] = (hh[4] &+ E)
|
||||
hh[5] = (hh[5] &+ F)
|
||||
hh[6] = (hh[6] &+ G)
|
||||
hh[7] = (hh[7] &+ H)
|
||||
}
|
||||
|
||||
// Produce the final hash value (big-endian)
|
||||
let buf: NSMutableData = NSMutableData();
|
||||
|
||||
variant.resultingArray(hh).forEach({ (item) -> () in
|
||||
var i = item.bigEndian
|
||||
buf.appendBytes(&i, length: sizeofValue(i))
|
||||
})
|
||||
|
||||
return buf.copy() as! NSData;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
//
|
||||
// StringExtension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 15/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** String extension */
|
||||
extension String {
|
||||
|
||||
/** Calculate MD5 hash */
|
||||
public func md5() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.md5()?.toHexString()
|
||||
}
|
||||
|
||||
public func sha1() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.sha1()?.toHexString()
|
||||
}
|
||||
|
||||
public func sha224() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.sha224()?.toHexString()
|
||||
}
|
||||
|
||||
public func sha256() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.sha256()?.toHexString()
|
||||
}
|
||||
|
||||
public func sha384() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.sha384()?.toHexString()
|
||||
}
|
||||
|
||||
public func sha512() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.sha512()?.toHexString()
|
||||
}
|
||||
|
||||
public func crc32() -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.crc32()?.toHexString()
|
||||
}
|
||||
|
||||
public func encrypt(cipher: Cipher) throws -> String? {
|
||||
return try self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.encrypt(cipher)?.toHexString()
|
||||
}
|
||||
|
||||
public func decrypt(cipher: Cipher) throws -> String? {
|
||||
return try self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.decrypt(cipher)?.toHexString()
|
||||
}
|
||||
|
||||
public func authenticate(authenticator: Authenticator) -> String? {
|
||||
return self.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)?.authenticate(authenticator)?.toHexString()
|
||||
}
|
||||
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
//
|
||||
// UInt16Extension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** Shift bits */
|
||||
extension UInt16 {
|
||||
/** Shift bits to the right. All bits are shifted (including sign bit) */
|
||||
mutating func shiftRight(count: UInt16) -> UInt16 {
|
||||
if (self == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
let bitsCount = UInt16(sizeofValue(self) * 8)
|
||||
|
||||
if (count >= bitsCount) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let maxBitsForValue = UInt16(floor(log2(Double(self) + 1)))
|
||||
let shiftCount = Swift.min(count, maxBitsForValue - 1)
|
||||
var shiftedValue:UInt16 = 0;
|
||||
|
||||
for bitIdx in 0..<bitsCount {
|
||||
let byte = 1 << bitIdx
|
||||
if ((self & byte) == byte) {
|
||||
shiftedValue = shiftedValue | (byte >> shiftCount)
|
||||
}
|
||||
}
|
||||
self = shiftedValue
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>> (lhs: UInt16, rhs: UInt16) -> UInt16 {
|
||||
var l = lhs;
|
||||
l.shiftRight(rhs)
|
||||
return l
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
//
|
||||
// UInt32Extension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** array of bytes */
|
||||
extension UInt32 {
|
||||
public func bytes(totalBytes: Int = sizeof(UInt32)) -> [UInt8] {
|
||||
return arrayOfBytes(self, length: totalBytes)
|
||||
}
|
||||
|
||||
public static func withBytes(bytes: ArraySlice<UInt8>) -> UInt32 {
|
||||
return UInt32.withBytes(Array(bytes))
|
||||
}
|
||||
|
||||
/** Int with array bytes (little-endian) */
|
||||
public static func withBytes(bytes: [UInt8]) -> UInt32 {
|
||||
return integerWithBytes(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
/** Shift bits */
|
||||
extension UInt32 {
|
||||
|
||||
/** Shift bits to the left. All bits are shifted (including sign bit) */
|
||||
private mutating func shiftLeft(count: UInt32) -> UInt32 {
|
||||
if (self == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
let bitsCount = UInt32(sizeof(UInt32) * 8)
|
||||
let shiftCount = Swift.min(count, bitsCount - 1)
|
||||
var shiftedValue:UInt32 = 0;
|
||||
|
||||
for bitIdx in 0..<bitsCount {
|
||||
// if bit is set then copy to result and shift left 1
|
||||
let bit = 1 << bitIdx
|
||||
if ((self & bit) == bit) {
|
||||
shiftedValue = shiftedValue | (bit << shiftCount)
|
||||
}
|
||||
}
|
||||
|
||||
if (shiftedValue != 0 && count >= bitsCount) {
|
||||
// clear last bit that couldn't be shifted out of range
|
||||
shiftedValue = shiftedValue & (~(1 << (bitsCount - 1)))
|
||||
}
|
||||
|
||||
self = shiftedValue
|
||||
return self
|
||||
}
|
||||
|
||||
/** Shift bits to the right. All bits are shifted (including sign bit) */
|
||||
private mutating func shiftRight(count: UInt32) -> UInt32 {
|
||||
if (self == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
let bitsCount = UInt32(sizeofValue(self) * 8)
|
||||
|
||||
if (count >= bitsCount) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let maxBitsForValue = UInt32(floor(log2(Double(self)) + 1))
|
||||
let shiftCount = Swift.min(count, maxBitsForValue - 1)
|
||||
var shiftedValue:UInt32 = 0;
|
||||
|
||||
for bitIdx in 0..<bitsCount {
|
||||
// if bit is set then copy to result and shift left 1
|
||||
let bit = 1 << bitIdx
|
||||
if ((self & bit) == bit) {
|
||||
shiftedValue = shiftedValue | (bit >> shiftCount)
|
||||
}
|
||||
}
|
||||
self = shiftedValue
|
||||
return self
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** shift left and assign with bits truncation */
|
||||
public func &<<= (inout lhs: UInt32, rhs: UInt32) {
|
||||
lhs.shiftLeft(rhs)
|
||||
}
|
||||
|
||||
/** shift left with bits truncation */
|
||||
public func &<< (lhs: UInt32, rhs: UInt32) -> UInt32 {
|
||||
var l = lhs;
|
||||
l.shiftLeft(rhs)
|
||||
return l
|
||||
}
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>>= (inout lhs: UInt32, rhs: UInt32) {
|
||||
lhs.shiftRight(rhs)
|
||||
}
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>> (lhs: UInt32, rhs: UInt32) -> UInt32 {
|
||||
var l = lhs;
|
||||
l.shiftRight(rhs)
|
||||
return l
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// UInt64Extension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 02/09/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** array of bytes */
|
||||
extension UInt64 {
|
||||
public func bytes(totalBytes: Int = sizeof(UInt64)) -> [UInt8] {
|
||||
return arrayOfBytes(self, length: totalBytes)
|
||||
}
|
||||
|
||||
public static func withBytes(bytes: ArraySlice<UInt8>) -> UInt64 {
|
||||
return UInt64.withBytes(Array(bytes))
|
||||
}
|
||||
|
||||
/** Int with array bytes (little-endian) */
|
||||
public static func withBytes(bytes: [UInt8]) -> UInt64 {
|
||||
return integerWithBytes(bytes)
|
||||
}
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
//
|
||||
// ByteExtension.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 07/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
/** casting */
|
||||
extension UInt8 {
|
||||
|
||||
/** cast because UInt8(<UInt32>) because std initializer crash if value is > byte */
|
||||
static func withValue(v:UInt64) -> UInt8 {
|
||||
let tmp = v & 0xFF
|
||||
return UInt8(tmp)
|
||||
}
|
||||
|
||||
static func withValue(v:UInt32) -> UInt8 {
|
||||
let tmp = v & 0xFF
|
||||
return UInt8(tmp)
|
||||
}
|
||||
|
||||
static func withValue(v:UInt16) -> UInt8 {
|
||||
let tmp = v & 0xFF
|
||||
return UInt8(tmp)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Bits */
|
||||
extension UInt8 {
|
||||
|
||||
init(bits: [Bit]) {
|
||||
self.init(integerFromBitsArray(bits) as UInt8)
|
||||
}
|
||||
|
||||
/** array of bits */
|
||||
func bits() -> [Bit] {
|
||||
let totalBitsCount = sizeofValue(self) * 8
|
||||
|
||||
var bitsArray = [Bit](count: totalBitsCount, repeatedValue: Bit.Zero)
|
||||
|
||||
for j in 0..<totalBitsCount {
|
||||
let bitVal:UInt8 = 1 << UInt8(totalBitsCount - 1 - j)
|
||||
let check = self & bitVal
|
||||
|
||||
if (check != 0) {
|
||||
bitsArray[j] = Bit.One;
|
||||
}
|
||||
}
|
||||
return bitsArray
|
||||
}
|
||||
|
||||
func bits() -> String {
|
||||
var s = String()
|
||||
let arr:[Bit] = self.bits()
|
||||
for (idx,b) in arr.enumerate() {
|
||||
s += (b == Bit.One ? "1" : "0")
|
||||
if ((idx + 1) % 8 == 0) { s += " " }
|
||||
}
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
/** Shift bits */
|
||||
extension UInt8 {
|
||||
/** Shift bits to the right. All bits are shifted (including sign bit) */
|
||||
mutating func shiftRight(count: UInt8) -> UInt8 {
|
||||
if (self == 0) {
|
||||
return self;
|
||||
}
|
||||
|
||||
let bitsCount = UInt8(sizeof(UInt8) * 8)
|
||||
|
||||
if (count >= bitsCount) {
|
||||
return 0
|
||||
}
|
||||
|
||||
let maxBitsForValue = UInt8(floor(log2(Double(self) + 1)))
|
||||
let shiftCount = Swift.min(count, maxBitsForValue - 1)
|
||||
var shiftedValue:UInt8 = 0;
|
||||
|
||||
for bitIdx in 0..<bitsCount {
|
||||
let byte = 1 << bitIdx
|
||||
if ((self & byte) == byte) {
|
||||
shiftedValue = shiftedValue | (byte >> shiftCount)
|
||||
}
|
||||
}
|
||||
self = shiftedValue
|
||||
return self
|
||||
}
|
||||
}
|
||||
|
||||
/** shift right and assign with bits truncation */
|
||||
func &>> (lhs: UInt8, rhs: UInt8) -> UInt8 {
|
||||
var l = lhs;
|
||||
l.shiftRight(rhs)
|
||||
return l
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
//
|
||||
// Utils.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 26/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func rotateLeft(v:UInt8, n:UInt8) -> UInt8 {
|
||||
return ((v << n) & 0xFF) | (v >> (8 - n))
|
||||
}
|
||||
|
||||
func rotateLeft(v:UInt16, n:UInt16) -> UInt16 {
|
||||
return ((v << n) & 0xFFFF) | (v >> (16 - n))
|
||||
}
|
||||
|
||||
func rotateLeft(v:UInt32, n:UInt32) -> UInt32 {
|
||||
return ((v << n) & 0xFFFFFFFF) | (v >> (32 - n))
|
||||
}
|
||||
|
||||
func rotateLeft(x:UInt64, n:UInt64) -> UInt64 {
|
||||
return (x << n) | (x >> (64 - n))
|
||||
}
|
||||
|
||||
func rotateRight(x:UInt16, n:UInt16) -> UInt16 {
|
||||
return (x >> n) | (x << (16 - n))
|
||||
}
|
||||
|
||||
func rotateRight(x:UInt32, n:UInt32) -> UInt32 {
|
||||
return (x >> n) | (x << (32 - n))
|
||||
}
|
||||
|
||||
func rotateRight(x:UInt64, n:UInt64) -> UInt64 {
|
||||
return ((x >> n) | (x << (64 - n)))
|
||||
}
|
||||
|
||||
func reverseBytes(value: UInt32) -> UInt32 {
|
||||
return ((value & 0x000000FF) << 24) | ((value & 0x0000FF00) << 8) | ((value & 0x00FF0000) >> 8) | ((value & 0xFF000000) >> 24);
|
||||
}
|
||||
|
||||
func xor(a: [UInt8], b:[UInt8]) -> [UInt8] {
|
||||
var xored = [UInt8](count: a.count, repeatedValue: 0)
|
||||
for i in 0..<xored.count {
|
||||
xored[i] = a[i] ^ b[i]
|
||||
}
|
||||
return xored
|
||||
}
|
||||
|
||||
func perf(text: String, closure: () -> ()) {
|
||||
let measurementStart = NSDate();
|
||||
|
||||
closure()
|
||||
|
||||
let measurementStop = NSDate();
|
||||
let executionTime = measurementStop.timeIntervalSinceDate(measurementStart)
|
||||
|
||||
print("\(text) \(executionTime)");
|
||||
}
|
|
@ -1,260 +0,0 @@
|
|||
//
|
||||
// CipherAESTests.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/12/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class AESTests: XCTestCase {
|
||||
// 128 bit key
|
||||
let aesKey:[UInt8] = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
|
||||
|
||||
func testAES_encrypt2() {
|
||||
let key:[UInt8] = [0x36, 0x37, 0x39, 0x66, 0x62, 0x31, 0x64, 0x64, 0x66, 0x37, 0x64, 0x38, 0x31, 0x62, 0x65, 0x65];
|
||||
let iv:[UInt8] = [0x6b, 0x64, 0x66, 0x36, 0x37, 0x33, 0x39, 0x38, 0x44, 0x46, 0x37, 0x33, 0x38, 0x33, 0x66, 0x64]
|
||||
let input:[UInt8] = [0x62, 0x72, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
|
||||
|
||||
let expected:[UInt8] = [0xae,0x8c,0x59,0x95,0xb2,0x6f,0x8e,0x3d,0xb0,0x6f,0x0a,0xa5,0xfe,0xc4,0xf0,0xc2];
|
||||
|
||||
if let aes = AES(key: key, iv: iv, blockMode: .CBC) {
|
||||
let encrypted = try! aes.encrypt(input, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, input, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_encrypt3() {
|
||||
let key = "679fb1ddf7d81bee"
|
||||
let iv = "kdf67398DF7383fd"
|
||||
let input:[UInt8] = [0x62, 0x72, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
|
||||
|
||||
let expected:[UInt8] = [0xae,0x8c,0x59,0x95,0xb2,0x6f,0x8e,0x3d,0xb0,0x6f,0x0a,0xa5,0xfe,0xc4,0xf0,0xc2];
|
||||
|
||||
if let aes = AES(key: key, iv: iv, blockMode: .CBC) {
|
||||
let encrypted = try! aes.encrypt(input, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, input, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_encrypt() {
|
||||
let input:[UInt8] = [0x00, 0x11, 0x22, 0x33,
|
||||
0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xaa, 0xbb,
|
||||
0xcc, 0xdd, 0xee, 0xff];
|
||||
|
||||
let expected:[UInt8] = [0x69, 0xc4, 0xe0, 0xd8,
|
||||
0x6a, 0x7b, 0x4, 0x30,
|
||||
0xd8, 0xcd, 0xb7, 0x80,
|
||||
0x70, 0xb4, 0xc5, 0x5a];
|
||||
|
||||
if let aes = AES(key: aesKey, blockMode: .ECB) {
|
||||
let encrypted = try! aes.encrypt(input, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, input, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_encrypt_cbc() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
|
||||
let plaintext:[UInt8] = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
|
||||
let expected:[UInt8] = [0x76,0x49,0xab,0xac,0x81,0x19,0xb2,0x46,0xce,0xe9,0x8e,0x9b,0x12,0xe9,0x19,0x7d];
|
||||
|
||||
if let aes = AES(key: key, iv:iv, blockMode: .CBC) {
|
||||
XCTAssertTrue(aes.blockMode == .CBC, "Invalid block mode")
|
||||
let encrypted = try! aes.encrypt(plaintext, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, plaintext, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_encrypt_cfb() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
|
||||
let plaintext:[UInt8] = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
|
||||
let expected:[UInt8] = [0x3b,0x3f,0xd9,0x2e,0xb7,0x2d,0xad,0x20,0x33,0x34,0x49,0xf8,0xe8,0x3c,0xfb,0x4a];
|
||||
|
||||
if let aes = AES(key: key, iv:iv, blockMode: .CFB) {
|
||||
XCTAssertTrue(aes.blockMode == .CFB, "Invalid block mode")
|
||||
let encrypted = try! aes.encrypt(plaintext, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, plaintext, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_encrypt_ctr() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff]
|
||||
let plaintext:[UInt8] = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
|
||||
let expected:[UInt8] = [103, 238, 5, 84, 116, 153, 248, 188, 240, 195, 131, 36, 232, 96, 92, 40]
|
||||
|
||||
if let aes = AES(key: key, iv:iv, blockMode: .CTR) {
|
||||
XCTAssertTrue(aes.blockMode == .CTR, "Invalid block mode")
|
||||
let encrypted = try! aes.encrypt(plaintext, padding: nil)
|
||||
XCTAssertEqual(encrypted, expected, "encryption failed")
|
||||
let decrypted = try! aes.decrypt(encrypted, padding: nil)
|
||||
XCTAssertEqual(decrypted, plaintext, "decryption failed")
|
||||
} else {
|
||||
XCTAssert(false, "failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_SubBytes() {
|
||||
let input:[[UInt8]] = [[0x00, 0x10, 0x20, 0x30],
|
||||
[0x40, 0x50, 0x60, 0x70],
|
||||
[0x80, 0x90, 0xa0, 0xb0],
|
||||
[0xc0, 0xd0, 0xe0, 0xf0]]
|
||||
|
||||
let expected:[[UInt8]] = [[0x63, 0xca, 0xb7, 0x04],
|
||||
[0x09, 0x53, 0xd0, 0x51],
|
||||
[0xcd, 0x60, 0xe0, 0xe7],
|
||||
[0xba, 0x70, 0xe1, 0x8c]]
|
||||
|
||||
var substituted = input
|
||||
AES(key: aesKey, blockMode: .CBC)!.subBytes(&substituted)
|
||||
XCTAssertTrue(compareMatrix(expected, b: substituted), "subBytes failed")
|
||||
let inverted = AES(key: aesKey, blockMode: .CBC)!.invSubBytes(substituted)
|
||||
XCTAssertTrue(compareMatrix(input, b: inverted), "invSubBytes failed")
|
||||
}
|
||||
|
||||
func testAES_shiftRows() {
|
||||
let input:[[UInt8]] = [[0x63, 0x09, 0xcd, 0xba],
|
||||
[0xca, 0x53, 0x60, 0x70],
|
||||
[0xb7, 0xd0, 0xe0, 0xe1],
|
||||
[0x04, 0x51, 0xe7, 0x8c]]
|
||||
|
||||
let expected:[[UInt8]] = [[0x63, 0x9, 0xcd, 0xba],
|
||||
[0x53, 0x60, 0x70, 0xca],
|
||||
[0xe0, 0xe1, 0xb7, 0xd0],
|
||||
[0x8c, 0x4, 0x51, 0xe7]]
|
||||
|
||||
let shifted = AES(key: aesKey, blockMode: .CBC)!.shiftRows(input)
|
||||
XCTAssertTrue(compareMatrix(expected, b: shifted), "shiftRows failed")
|
||||
let inverted = AES(key: aesKey, blockMode: .CBC)!.invShiftRows(shifted)
|
||||
XCTAssertTrue(compareMatrix(input, b: inverted), "invShiftRows failed")
|
||||
}
|
||||
|
||||
func testAES_multiply() {
|
||||
XCTAssertTrue(AES(key: aesKey, blockMode: .CBC)?.multiplyPolys(0x0e, 0x5f) == 0x17, "Multiplication failed")
|
||||
}
|
||||
|
||||
func testAES_expandKey() {
|
||||
let expected:[UInt8] = [0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0xd6, 0xaa, 0x74, 0xfd, 0xd2, 0xaf, 0x72, 0xfa, 0xda, 0xa6, 0x78, 0xf1, 0xd6, 0xab, 0x76, 0xfe, 0xb6, 0x92, 0xcf, 0xb, 0x64, 0x3d, 0xbd, 0xf1, 0xbe, 0x9b, 0xc5, 0x0, 0x68, 0x30, 0xb3, 0xfe, 0xb6, 0xff, 0x74, 0x4e, 0xd2, 0xc2, 0xc9, 0xbf, 0x6c, 0x59, 0xc, 0xbf, 0x4, 0x69, 0xbf, 0x41, 0x47, 0xf7, 0xf7, 0xbc, 0x95, 0x35, 0x3e, 0x3, 0xf9, 0x6c, 0x32, 0xbc, 0xfd, 0x5, 0x8d, 0xfd, 0x3c, 0xaa, 0xa3, 0xe8, 0xa9, 0x9f, 0x9d, 0xeb, 0x50, 0xf3, 0xaf, 0x57, 0xad, 0xf6, 0x22, 0xaa, 0x5e, 0x39, 0xf, 0x7d, 0xf7, 0xa6, 0x92, 0x96, 0xa7, 0x55, 0x3d, 0xc1, 0xa, 0xa3, 0x1f, 0x6b, 0x14, 0xf9, 0x70, 0x1a, 0xe3, 0x5f, 0xe2, 0x8c, 0x44, 0xa, 0xdf, 0x4d, 0x4e, 0xa9, 0xc0, 0x26, 0x47, 0x43, 0x87, 0x35, 0xa4, 0x1c, 0x65, 0xb9, 0xe0, 0x16, 0xba, 0xf4, 0xae, 0xbf, 0x7a, 0xd2, 0x54, 0x99, 0x32, 0xd1, 0xf0, 0x85, 0x57, 0x68, 0x10, 0x93, 0xed, 0x9c, 0xbe, 0x2c, 0x97, 0x4e, 0x13, 0x11, 0x1d, 0x7f, 0xe3, 0x94, 0x4a, 0x17, 0xf3, 0x7, 0xa7, 0x8b, 0x4d, 0x2b, 0x30, 0xc5]
|
||||
|
||||
if let aes = AES(key: aesKey, blockMode: .CBC) {
|
||||
XCTAssertEqual(expected, aes.expandedKey, "expandKey failed")
|
||||
} else {
|
||||
XCTAssert(false, "")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_addRoundKey() {
|
||||
let input:[[UInt8]] = [[0x00, 0x44, 0x88, 0xcc],
|
||||
[0x11, 0x55, 0x99, 0xdd],
|
||||
[0x22, 0x66, 0xaa, 0xee],
|
||||
[0x33, 0x77, 0xbb, 0xff]]
|
||||
|
||||
let expected:[[UInt8]] = [[0, 64, 128, 192],
|
||||
[16, 80, 144, 208],
|
||||
[32, 96, 160, 224],
|
||||
[48, 112, 176, 240]]
|
||||
|
||||
if let aes = AES(key: aesKey, blockMode: .CBC) {
|
||||
let result = aes.addRoundKey(input, aes.expandedKey, 0)
|
||||
XCTAssertTrue(compareMatrix(expected, b: result), "addRoundKey failed")
|
||||
} else {
|
||||
XCTAssert(false, "")
|
||||
}
|
||||
}
|
||||
|
||||
func testAES_mixColumns() {
|
||||
let input:[[UInt8]] = [[0x63, 0x9, 0xcd, 0xba],
|
||||
[0x53, 0x60, 0x70, 0xca],
|
||||
[0xe0, 0xe1, 0xb7, 0xd0],
|
||||
[0x8c, 0x4, 0x51, 0xe7]]
|
||||
|
||||
let expected:[[UInt8]] = [[0x5f, 0x57, 0xf7, 0x1d],
|
||||
[0x72, 0xf5, 0xbe, 0xb9],
|
||||
[0x64, 0xbc, 0x3b, 0xf9],
|
||||
[0x15, 0x92, 0x29, 0x1a]]
|
||||
|
||||
if let aes = AES(key: aesKey, blockMode: .CBC) {
|
||||
let mixed = aes.mixColumns(input)
|
||||
XCTAssertTrue(compareMatrix(expected, b: mixed), "mixColumns failed")
|
||||
let inverted = aes.invMixColumns(mixed)
|
||||
XCTAssertTrue(compareMatrix(input, b: inverted), "invMixColumns failed")
|
||||
} else {
|
||||
XCTAssert(false, "")
|
||||
}
|
||||
}
|
||||
|
||||
func testAESPerformance() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
|
||||
let message = [UInt8](count: 1024 * 1024, repeatedValue: 7)
|
||||
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, forBlock: { () -> Void in
|
||||
try! AES(key: key, iv: iv, blockMode: .CBC)?.encrypt(message, padding: PKCS7())
|
||||
})
|
||||
}
|
||||
|
||||
func testAESPerformanceCommonCrypto() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
|
||||
let message = [UInt8](count: 1024 * 1024, repeatedValue: 7)
|
||||
|
||||
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, forBlock: { () -> Void in
|
||||
let keyData = NSData.withBytes(key)
|
||||
let keyBytes = UnsafePointer<Void>(keyData.bytes)
|
||||
let ivData = NSData.withBytes(iv)
|
||||
let ivBytes = UnsafePointer<Void>(ivData.bytes)
|
||||
|
||||
let data = NSData.withBytes(message)
|
||||
let dataLength = data.length
|
||||
let dataBytes = UnsafePointer<Void>(data.bytes)
|
||||
|
||||
let cryptData = NSMutableData(length: Int(dataLength) + kCCBlockSizeAES128)
|
||||
let cryptPointer = UnsafeMutablePointer<Void>(cryptData!.mutableBytes)
|
||||
let cryptLength = cryptData!.length
|
||||
|
||||
var numBytesEncrypted:Int = 0
|
||||
|
||||
self.startMeasuring()
|
||||
|
||||
CCCrypt(
|
||||
UInt32(kCCEncrypt),
|
||||
UInt32(kCCAlgorithmAES128),
|
||||
UInt32(kCCOptionPKCS7Padding),
|
||||
keyBytes,
|
||||
key.count,
|
||||
ivBytes,
|
||||
dataBytes,
|
||||
dataLength,
|
||||
cryptPointer, cryptLength,
|
||||
&numBytesEncrypted)
|
||||
|
||||
self.stopMeasuring()
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
//
|
||||
// Bridging.h
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 04/02/15.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef CryptoSwift_Bridging_h
|
||||
#define CryptoSwift_Bridging_h
|
||||
|
||||
#import <CommonCrypto/CommonCrypto.h>
|
||||
|
||||
#endif
|
|
@ -1,86 +0,0 @@
|
|||
//
|
||||
// CipherChaCha20Tests.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/12/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class ChaCha20Tests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testChaCha20() {
|
||||
let keys:[[UInt8]] = [
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01],
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F]
|
||||
]
|
||||
|
||||
let ivs:[[UInt8]] = [
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01],
|
||||
[0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
|
||||
[0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07]
|
||||
]
|
||||
|
||||
let expectedHexes = [
|
||||
"76B8E0ADA0F13D90405D6AE55386BD28BDD219B8A08DED1AA836EFCC8B770DC7DA41597C5157488D7724E03FB8D84A376A43B8F41518A11CC387B669B2EE6586",
|
||||
"4540F05A9F1FB296D7736E7B208E3C96EB4FE1834688D2604F450952ED432D41BBE2A0B6EA7566D2A5D1E7E20D42AF2C53D792B1C43FEA817E9AD275AE546963",
|
||||
"DE9CBA7BF3D69EF5E786DC63973F653A0B49E015ADBFF7134FCB7DF137821031E85A050278A7084527214F73EFC7FA5B5277062EB7A0433E445F41E3",
|
||||
"EF3FDFD6C61578FBF5CF35BD3DD33B8009631634D21E42AC33960BD138E50D32111E4CAF237EE53CA8AD6426194A88545DDC497A0B466E7D6BBDB0041B2F586B",
|
||||
"F798A189F195E66982105FFB640BB7757F579DA31602FC93EC01AC56F85AC3C134A4547B733B46413042C9440049176905D3BE59EA1C53F15916155C2BE8241A38008B9A26BC35941E2444177C8ADE6689DE95264986D95889FB60E84629C9BD9A5ACB1CC118BE563EB9B3A4A472F82E09A7E778492B562EF7130E88DFE031C79DB9D4F7C7A899151B9A475032B63FC385245FE054E3DD5A97A5F576FE064025D3CE042C566AB2C507B138DB853E3D6959660996546CC9C4A6EAFDC777C040D70EAF46F76DAD3979E5C5360C3317166A1C894C94A371876A94DF7628FE4EAAF2CCB27D5AAAE0AD7AD0F9D4B6AD3B54098746D4524D38407A6DEB3AB78FAB78C9"
|
||||
]
|
||||
|
||||
for (var idx = 0; idx < keys.count; idx++) {
|
||||
|
||||
let expectedHex = expectedHexes[idx]
|
||||
let message = [UInt8](count: (expectedHex.characters.count / 2), repeatedValue: 0)
|
||||
|
||||
let setup = (key: keys[idx], iv: ivs[idx])
|
||||
do {
|
||||
let encrypted = try Cipher.ChaCha20(setup).encrypt(message)
|
||||
let decrypted = try Cipher.ChaCha20(setup).decrypt(encrypted)
|
||||
XCTAssertEqual(message, decrypted, "ChaCha20 decryption failed");
|
||||
|
||||
// check extension
|
||||
let messageData = NSData(bytes: message, length: message.count);
|
||||
let encrypted2 = try! messageData.encrypt(Cipher.ChaCha20(setup))
|
||||
XCTAssertNotNil(encrypted2, "")
|
||||
if let encrypted2 = encrypted2 {
|
||||
XCTAssertEqual(NSData.withBytes(encrypted), encrypted2, "ChaCha20 extension failed")
|
||||
}
|
||||
} catch Cipher.Error.EncryptError {
|
||||
XCTAssert(false, "Encryption failed")
|
||||
} catch Cipher.Error.DecryptError {
|
||||
XCTAssert(false, "Decryption failed")
|
||||
} catch {
|
||||
XCTAssert(false, "Failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testChaCha20Performance() {
|
||||
let key:[UInt8] = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
|
||||
let iv:[UInt8] = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
|
||||
let message = [UInt8](count: (1024 * 1024) * 1, repeatedValue: 7)
|
||||
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, forBlock: { () -> Void in
|
||||
let encrypted = try! ChaCha20(key: key, iv: iv)?.encrypt(message)
|
||||
self.stopMeasuring()
|
||||
XCTAssert(encrypted != nil, "not encrypted")
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
//
|
||||
// ExtensionsTest.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 15/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class ExtensionsTest: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testArrayChunksPerformance() {
|
||||
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, forBlock: { () -> Void in
|
||||
let message = [UInt8](count: 1024 * 1024, repeatedValue: 7)
|
||||
self.startMeasuring()
|
||||
message.chunks(AES.blockSize)
|
||||
self.stopMeasuring()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
func testIntExtension() {
|
||||
let i1:Int = 1024
|
||||
let i1Array = i1.bytes(32 / 8) // 32 bit
|
||||
let i1recovered = Int.withBytes(i1Array)
|
||||
|
||||
XCTAssertEqual(i1, i1recovered, "Bytes conversion failed")
|
||||
|
||||
let i2:Int = 1024
|
||||
let i2Array = i2.bytes(160 / 8) // 160 bit
|
||||
let i2recovered = Int.withBytes(i2Array)
|
||||
|
||||
XCTAssertEqual(i2, i2recovered, "Bytes conversion failed")
|
||||
}
|
||||
|
||||
func testBytes() {
|
||||
let size = sizeof(UInt32) // 32 or 64 bit
|
||||
|
||||
let i:UInt32 = 1024
|
||||
var bytes = i.bytes()
|
||||
XCTAssertTrue(bytes.count == size, "Invalid bytes length = \(bytes.count)")
|
||||
|
||||
// test padding
|
||||
bytes = i.bytes(16)
|
||||
XCTAssertTrue(bytes.count == 16, "Invalid return type \(bytes.count)")
|
||||
XCTAssertTrue(bytes[14] == 4, "Invalid return type \(bytes.count)")
|
||||
}
|
||||
|
||||
func testShiftLeft() {
|
||||
// Unsigned
|
||||
let i:UInt32 = 1
|
||||
XCTAssert(i &<< 1 == 2, "shift left failed")
|
||||
XCTAssert(i &<< 8 == 256, "shift left failed")
|
||||
XCTAssert(i &<< 31 == i << 31, "shift left failed")
|
||||
XCTAssert(i &<< 32 == 0, "shift left failed")
|
||||
|
||||
// Signed
|
||||
let ii:Int = 21
|
||||
XCTAssert(ii &<< 1 == ii << 1, "shift left failed")
|
||||
XCTAssert(ii &<< 8 == ii << 8, "shift left failed")
|
||||
XCTAssert(ii &<< ((sizeofValue(ii) * 8) - 1) == ii << ((sizeofValue(ii) * 8) - 1), "shift left failed")
|
||||
XCTAssert(ii &<< ((sizeofValue(ii) * 8)) == 0, "shift left failed")
|
||||
|
||||
let iii:UInt32 = 21
|
||||
XCTAssert(iii &<< 1 == iii << 1, "shift left failed")
|
||||
XCTAssert(iii &<< 8 == iii << 8, "shift left failed")
|
||||
XCTAssert((iii &<< 32) == 0, "shift left failed")
|
||||
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// HMACTests.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 29/08/14.
|
||||
// Copyright (c) 2015 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class HMACTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
func testMD5() {
|
||||
let key:[UInt8] = []
|
||||
let msg:[UInt8] = []
|
||||
let expectedMac:[UInt8] = [0x74,0xe6,0xf7,0x29,0x8a,0x9c,0x2d,0x16,0x89,0x35,0xf5,0x8c,0x00,0x1b,0xad,0x88]
|
||||
|
||||
let hmac = Authenticator.HMAC(key: key, variant: .md5).authenticate(msg)
|
||||
XCTAssertEqual(hmac!, expectedMac, "Invalid authentication result")
|
||||
}
|
||||
|
||||
func testSHA1() {
|
||||
let key:[UInt8] = []
|
||||
let msg:[UInt8] = []
|
||||
let expectedMac:[UInt8] = [0xfb,0xdb,0x1d,0x1b,0x18,0xaa,0x6c,0x08,0x32,0x4b,0x7d,0x64,0xb7,0x1f,0xb7,0x63,0x70,0x69,0x0e,0x1d]
|
||||
|
||||
let hmac = Authenticator.HMAC(key: key, variant: .sha1).authenticate(msg)
|
||||
XCTAssertEqual(hmac!, expectedMac, "Invalid authentication result")
|
||||
}
|
||||
|
||||
func testSHA256() {
|
||||
let key:[UInt8] = []
|
||||
let msg:[UInt8] = []
|
||||
let expectedMac:[UInt8] = [0xb6,0x13,0x67,0x9a,0x08,0x14,0xd9,0xec,0x77,0x2f,0x95,0xd7,0x78,0xc3,0x5f,0xc5,0xff,0x16,0x97,0xc4,0x93,0x71,0x56,0x53,0xc6,0xc7,0x12,0x14,0x42,0x92,0xc5,0xad]
|
||||
|
||||
let hmac = Authenticator.HMAC(key: key, variant: .sha256).authenticate(msg)
|
||||
XCTAssertEqual(hmac!, expectedMac, "Invalid authentication result")
|
||||
}
|
||||
|
||||
func testSHA384() {
|
||||
let key:[UInt8] = []
|
||||
let msg:[UInt8] = []
|
||||
let expectedMac:[UInt8] = [0x6c, 0x1f, 0x2e, 0xe9, 0x38, 0xfa, 0xd2, 0xe2, 0x4b, 0xd9, 0x12, 0x98, 0x47, 0x43, 0x82, 0xca, 0x21, 0x8c, 0x75, 0xdb, 0x3d, 0x83, 0xe1, 0x14, 0xb3, 0xd4, 0x36, 0x77, 0x76, 0xd1, 0x4d, 0x35, 0x51, 0x28, 0x9e, 0x75, 0xe8, 0x20, 0x9c, 0xd4, 0xb7, 0x92, 0x30, 0x28, 0x40, 0x23, 0x4a, 0xdc]
|
||||
|
||||
let hmac = Authenticator.HMAC(key: key, variant: .sha384).authenticate(msg)
|
||||
XCTAssertEqual(hmac!, expectedMac, "Invalid authentication result")
|
||||
}
|
||||
|
||||
func testSHA512() {
|
||||
let key:[UInt8] = []
|
||||
let msg:[UInt8] = []
|
||||
let expectedMac:[UInt8] = [0xb9, 0x36, 0xce, 0xe8, 0x6c, 0x9f, 0x87, 0xaa, 0x5d, 0x3c, 0x6f, 0x2e, 0x84, 0xcb, 0x5a, 0x42, 0x39, 0xa5, 0xfe, 0x50, 0x48, 0x0a, 0x6e, 0xc6, 0x6b, 0x70, 0xab, 0x5b, 0x1f, 0x4a, 0xc6, 0x73, 0x0c, 0x6c, 0x51, 0x54, 0x21, 0xb3, 0x27, 0xec, 0x1d, 0x69, 0x40, 0x2e, 0x53, 0xdf, 0xb4, 0x9a, 0xd7, 0x38, 0x1e, 0xb0, 0x67, 0xb3, 0x38, 0xfd, 0x7b, 0x0c, 0xb2, 0x22, 0x47, 0x22, 0x5d, 0x47]
|
||||
|
||||
let hmac = Authenticator.HMAC(key: key, variant: .sha512).authenticate(msg)
|
||||
XCTAssertEqual(hmac!, expectedMac, "Invalid authentication result")
|
||||
}
|
||||
}
|
|
@ -1,210 +0,0 @@
|
|||
//
|
||||
// CryptoSwiftTests.swift
|
||||
// CryptoSwiftTests
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 06/07/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class CryptoSwiftTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testMD5() {
|
||||
let data1:NSData = NSData(bytes: [0x31, 0x32, 0x33] as [UInt8], length: 3) // "1", "2", "3"
|
||||
if let hash = Hash.md5(data1).calculate() {
|
||||
XCTAssertEqual(hash.toHexString(), "202cb962ac59075b964b07152d234b70", "MD5 calculation failed");
|
||||
} else {
|
||||
XCTAssert(false, "Missing result")
|
||||
}
|
||||
|
||||
let string:NSString = ""
|
||||
let data:NSData = string.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
|
||||
if let hashData = Hash.md5(data).calculate() {
|
||||
XCTAssertEqual(hashData.toHexString(), "d41d8cd98f00b204e9800998ecf8427e", "MD5 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "Missing result")
|
||||
}
|
||||
|
||||
if let hash = data1.md5() {
|
||||
XCTAssertEqual(hash.toHexString(), "202cb962ac59075b964b07152d234b70", "MD5 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "123".md5() {
|
||||
XCTAssertEqual(hash, "202cb962ac59075b964b07152d234b70", "MD5 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "".md5() {
|
||||
XCTAssertEqual(hash, "d41d8cd98f00b204e9800998ecf8427e", "MD5 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "Hash for empty string is missing")
|
||||
}
|
||||
|
||||
if let hash = "a".md5() {
|
||||
XCTAssertEqual(hash, "0cc175b9c0f1b6a831c399e269772661", "MD5 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "abc".md5() {
|
||||
XCTAssertEqual(hash, "900150983cd24fb0d6963f7d28e17f72", "MD5 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "message digest".md5() {
|
||||
XCTAssertEqual(hash, "f96b697d7cb7938d525a2f31aaf161d0", "MD5 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "abcdefghijklmnopqrstuvwxyz".md5() {
|
||||
XCTAssertEqual(hash, "c3fcd3d76192e4007dfb496cca67e13b", "MD5 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".md5() {
|
||||
XCTAssertEqual(hash, "d174ab98d277d9f5a5611c2c9f419d9f", "MD5 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "12345678901234567890123456789012345678901234567890123456789012345678901234567890".md5() {
|
||||
XCTAssertEqual(hash, "57edf4a22be3c955ac49da2e2107b67a", "MD5 calculation failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testMD5PerformanceSwift() {
|
||||
self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, forBlock: { () -> Void in
|
||||
let buf = UnsafeMutablePointer<UInt8>(calloc(2048, sizeof(UInt8)))
|
||||
let data = NSData(bytes: buf, length: 2048)
|
||||
self.startMeasuring()
|
||||
Hash.md5(data).calculate()
|
||||
self.stopMeasuring()
|
||||
buf.dealloc(1024)
|
||||
buf.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
func testMD5PerformanceCommonCrypto() {
|
||||
self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, forBlock: { () -> Void in
|
||||
let buf = UnsafeMutablePointer<UInt8>(calloc(2048, sizeof(UInt8)))
|
||||
let data = NSData(bytes: buf, length: 2048)
|
||||
self.startMeasuring()
|
||||
let outbuf = UnsafeMutablePointer<UInt8>.alloc(Int(CC_MD5_DIGEST_LENGTH))
|
||||
CC_MD5(data.bytes, CC_LONG(data.length), outbuf)
|
||||
//let output = NSData(bytes: outbuf, length: Int(CC_MD5_DIGEST_LENGTH));
|
||||
outbuf.dealloc(Int(CC_MD5_DIGEST_LENGTH))
|
||||
outbuf.destroy()
|
||||
self.stopMeasuring()
|
||||
buf.dealloc(1024)
|
||||
buf.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
func testSHA1() {
|
||||
let data:NSData = NSData(bytes: [0x31, 0x32, 0x33] as [UInt8], length: 3)
|
||||
if let hash = data.sha1() {
|
||||
XCTAssertEqual(hash.toHexString(), "40bd001563085fc35165329ea1ff5c5ecbdbbeef", "SHA1 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "abc".sha1() {
|
||||
XCTAssertEqual(hash, "a9993e364706816aba3e25717850c26c9cd0d89d", "SHA1 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".sha1() {
|
||||
XCTAssertEqual(hash, "84983e441c3bd26ebaae4aa1f95129e5e54670f1", "SHA1 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "".sha1() {
|
||||
XCTAssertEqual(hash, "da39a3ee5e6b4b0d3255bfef95601890afd80709", "SHA1 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "SHA1 calculation failed")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func testSHA224() {
|
||||
let data:NSData = NSData(bytes: [0x31, 0x32, 0x33] as [UInt8], length: 3)
|
||||
if let hash = data.sha224() {
|
||||
XCTAssertEqual(hash.toHexString(), "78d8045d684abd2eece923758f3cd781489df3a48e1278982466017f", "SHA224 calculation failed");
|
||||
}
|
||||
}
|
||||
|
||||
func testSHA256() {
|
||||
let data:NSData = NSData(bytes: [0x31, 0x32, 0x33] as [UInt8], length: 3)
|
||||
if let hash = data.sha256() {
|
||||
XCTAssertEqual(hash.toHexString(), "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3", "SHA256 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "Rosetta code".sha256() {
|
||||
XCTAssertEqual(hash, "764faf5c61ac315f1497f9dfa542713965b785e5cc2f707d6468d7d1124cdfcf", "SHA256 calculation failed")
|
||||
}
|
||||
|
||||
if let hash = "".sha256() {
|
||||
XCTAssertEqual(hash, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "SHA256 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "SHA256 calculation failed")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func testSHA384() {
|
||||
let data:NSData = NSData(bytes: [49, 50, 51] as [UInt8], length: 3)
|
||||
if let hash = data.sha384() {
|
||||
XCTAssertEqual(hash.toHexString(), "9a0a82f0c0cf31470d7affede3406cc9aa8410671520b727044eda15b4c25532a9b5cd8aaf9cec4919d76255b6bfb00f", "SHA384 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "The quick brown fox jumps over the lazy dog.".sha384() {
|
||||
XCTAssertEqual(hash, "ed892481d8272ca6df370bf706e4d7bc1b5739fa2177aae6c50e946678718fc67a7af2819a021c2fc34e91bdb63409d7", "SHA384 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "".sha384() {
|
||||
XCTAssertEqual(hash, "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b", "SHA384 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "SHA384 calculation failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testSHA512() {
|
||||
let data:NSData = NSData(bytes: [49, 50, 51] as [UInt8], length: 3)
|
||||
if let hash = data.sha512() {
|
||||
XCTAssertEqual(hash.toHexString(), "3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7ab1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856bca5c44c2", "SHA512 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "The quick brown fox jumps over the lazy dog.".sha512() {
|
||||
XCTAssertEqual(hash, "91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bbc6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed", "SHA512 calculation failed");
|
||||
}
|
||||
|
||||
if let hash = "".sha512() {
|
||||
XCTAssertEqual(hash, "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e", "SHA512 calculation failed")
|
||||
} else {
|
||||
XCTAssert(false, "SHA512 calculation failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testCRC32() {
|
||||
let data:NSData = NSData(bytes: [49, 50, 51] as [UInt8], length: 3)
|
||||
if let crc = data.crc32() {
|
||||
XCTAssertEqual(crc.toHexString(), "884863d2", "CRC32 calculation failed");
|
||||
}
|
||||
|
||||
if let crc = "".crc32() {
|
||||
XCTAssertEqual(crc, "00000000", "CRC32 calculation failed");
|
||||
} else {
|
||||
XCTAssert(false, "CRC32 calculation failed")
|
||||
}
|
||||
}
|
||||
|
||||
func testCRC32Async() {
|
||||
let expect = expectationWithDescription("CRC32")
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), { () -> Void in
|
||||
self.testCRC32()
|
||||
expect.fulfill()
|
||||
})
|
||||
|
||||
waitForExpectationsWithTimeout(10, handler: { (error) -> Void in
|
||||
XCTAssertNil(error, "CRC32 async failed")
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
//
|
||||
// Helpers.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/12/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func compareMatrix(a:[[UInt8]], b:[[UInt8]]) -> Bool {
|
||||
for (i,arr) in a.enumerate() {
|
||||
for (j,val) in arr.enumerate() {
|
||||
if (val != b[i][j]) {
|
||||
print("Not equal: \(val) vs \(b[i][j])") //FIXME: remove verbose
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.hakore.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
// PaddingTests.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 27/12/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class PaddingTests: XCTestCase {
|
||||
func testPKCS7_0() {
|
||||
let input:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6]
|
||||
let expected:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
|
||||
let padded = PKCS7().add(input, blockSize: 16)
|
||||
XCTAssertEqual(padded, expected, "PKCS7 failed")
|
||||
let clean = PKCS7().remove(padded, blockSize: nil)
|
||||
XCTAssertEqual(clean, input, "PKCS7 failed")
|
||||
}
|
||||
|
||||
func testPKCS7_1() {
|
||||
let input:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5]
|
||||
let expected:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,1]
|
||||
let padded = PKCS7().add(input, blockSize: 16)
|
||||
XCTAssertEqual(padded, expected, "PKCS7 failed")
|
||||
let clean = PKCS7().remove(padded, blockSize: nil)
|
||||
XCTAssertEqual(clean, input, "PKCS7 failed")
|
||||
}
|
||||
|
||||
func testPKCS7_2() {
|
||||
let input:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4]
|
||||
let expected:[UInt8] = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,2,2]
|
||||
let padded = PKCS7().add(input, blockSize: 16)
|
||||
XCTAssertEqual(padded, expected, "PKCS7 failed")
|
||||
let clean = PKCS7().remove(padded, blockSize: nil)
|
||||
XCTAssertEqual(clean, input, "PKCS7 failed")
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
//
|
||||
// Poly1305Tests.swift
|
||||
// CryptoSwift
|
||||
//
|
||||
// Created by Marcin Krzyzanowski on 29/08/14.
|
||||
// Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import XCTest
|
||||
@testable import CryptoSwift
|
||||
|
||||
final class Poly1305Tests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
func testPoly1305() {
|
||||
let key:[UInt8] = [0xdd,0xde,0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc]
|
||||
let msg:[UInt8] = [0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,0xc0,0xc1]
|
||||
let expectedMac:[UInt8] = [0xdd,0xb9,0xda,0x7d,0xdd,0x5e,0x52,0x79,0x27,0x30,0xed,0x5c,0xda,0x5f,0x90,0xa4]
|
||||
|
||||
if let mac = Authenticator.Poly1305(key: key).authenticate(msg) {
|
||||
XCTAssertEqual(mac, expectedMac, "Invalid authentication result")
|
||||
} else {
|
||||
XCTFail("Missing MAC")
|
||||
}
|
||||
|
||||
// extensions
|
||||
let msgData = NSData.withBytes(msg)
|
||||
if let mac2 = msgData.authenticate(Authenticator.Poly1305(key: key)) {
|
||||
XCTAssertEqual(mac2, NSData.withBytes(expectedMac), "Invalid authentication result")
|
||||
} else {
|
||||
XCTFail("Missing MAC")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
Copyright (C) 2014 Marcin Krzyżanowski <marcin.krzyzanowski@gmail.com>
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
- The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required.
|
||||
- Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
- This notice may not be removed or altered from any source or binary distribution.
|
|
@ -1,235 +0,0 @@
|
|||
#CryptoSwift
|
||||
|
||||
Crypto related functions and helpers for [Swift](https://developer.apple.com/swift/) implemented in Swift. ([#PureSwift](https://twitter.com/hashtag/pureswift))
|
||||
|
||||
-------
|
||||
<p align="center">
|
||||
<a href="#features">Features</a> •
|
||||
<a href="#contribution">Contribution</a> •
|
||||
<a href="#installation">Installation</a> •
|
||||
<a href="#usage">Usage</a> •
|
||||
<a href="#author">Author</a> •
|
||||
<a href="#changelog">Changelog</a>
|
||||
</p>
|
||||
-------
|
||||
|
||||
##Requirements
|
||||
Good mood
|
||||
|
||||
##Features
|
||||
|
||||
- Easy to use
|
||||
- Convenience extensions
|
||||
|
||||
##What implemented?
|
||||
|
||||
#### Hash
|
||||
- [MD5](http://tools.ietf.org/html/rfc1321)
|
||||
- [SHA1](http://tools.ietf.org/html/rfc3174)
|
||||
- [SHA224](http://tools.ietf.org/html/rfc6234)
|
||||
- [SHA256](http://tools.ietf.org/html/rfc6234)
|
||||
- [SHA384](http://tools.ietf.org/html/rfc6234)
|
||||
- [SHA512](http://tools.ietf.org/html/rfc6234)
|
||||
- [CRC32](http://en.wikipedia.org/wiki/Cyclic_redundancy_check) (well, kind of hash)
|
||||
|
||||
#####Cipher
|
||||
- [AES-128, AES-192, AES-256](http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf)
|
||||
- [ChaCha20](http://cr.yp.to/chacha/chacha-20080128.pdf)
|
||||
|
||||
#####Message authenticators
|
||||
- [Poly1305](http://cr.yp.to/mac/poly1305-20050329.pdf)
|
||||
- [HMAC](https://www.ietf.org/rfc/rfc2104.txt) MD5, SHA1, SHA256
|
||||
|
||||
#####Cipher block mode
|
||||
- Electronic codebook ([ECB](http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_.28ECB.29))
|
||||
- Cipher-block chaining ([CBC](http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29))
|
||||
- Cipher feedback ([CFB](http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_feedback_.28CFB.29))
|
||||
- Counter ([CTR](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_.28CTR.29))
|
||||
|
||||
#####Data padding
|
||||
- [PKCS#7](http://tools.ietf.org/html/rfc5652#section-6.3)
|
||||
|
||||
##Why
|
||||
[Why?](https://github.com/krzyzanowskim/CryptoSwift/issues/5) [Because I can](https://github.com/krzyzanowskim/CryptoSwift/issues/5#issuecomment-53379391).
|
||||
|
||||
##Contribution
|
||||
|
||||
For latest version, please check **develop** branch. This is latest development version that will be merged into **master** branch at some point.
|
||||
|
||||
##Installation
|
||||
|
||||
To install CryptoSwift, add it as a submodule to your project (on the top level project directory):
|
||||
|
||||
git submodule add https://github.com/krzyzanowskim/CryptoSwift.git
|
||||
|
||||
Then, drag the CryptoSwift.xcodeproj file into your Xcode project, and add CryptoSwift.framework as a dependency to your target. Now select your App and choose the General tab for the app target. Drag CryptoSwift.framework to "Embedded Binaries"
|
||||
|
||||
Alternatively, you can build the Universal Framework and link it in your Xcode project.
|
||||
Aggregate target `CryptoSwift-Universal` runs a script to build a universal framework. The script currently copies the framework to the `Framework` directory. (The path to CryptoSwift directory cannot contain any space)
|
||||
|
||||
Looking for version for Swift 1.2? check branch **swift12**, it's there.
|
||||
|
||||
#####iOS and OSX
|
||||
By default project is setup for iOS. You need to switch to OS X SDK manually [see #8](https://github.com/krzyzanowskim/CryptoSwift/issues/8)
|
||||
|
||||
####CocoaPods
|
||||
|
||||
You can use [CocoaPods](http://cocoapods.org/?q=cryptoSwift).
|
||||
|
||||
```ruby
|
||||
pod 'CryptoSwift'
|
||||
```
|
||||
|
||||
or for newest version from specified branch of code:
|
||||
|
||||
```ruby
|
||||
pod 'CryptoSwift', :git => "https://github.com/krzyzanowskim/CryptoSwift", :branch => "master"
|
||||
```
|
||||
|
||||
####Carthage
|
||||
You can use [Carthage](https://github.com/Carthage/Carthage).
|
||||
Specify in Cartfile:
|
||||
|
||||
```ruby
|
||||
github "krzyzanowskim/CryptoSwift"
|
||||
```
|
||||
|
||||
Then follow [build instructions](https://github.com/Carthage/Carthage#getting-started)
|
||||
|
||||
##Usage
|
||||
|
||||
```swift
|
||||
import CryptoSwift
|
||||
```
|
||||
|
||||
Generally you should use `CryptoSwift.Hash`, `CryptoSwift.Cipher` enums or convenience extensions
|
||||
|
||||
Hash enum usage
|
||||
```swift
|
||||
/* Hash enum usage */
|
||||
var data:NSData = NSData(bytes: [49, 50, 51] as [UInt8], length: 3)
|
||||
if let data = CryptoSwift.Hash.md5(data).calculate() {
|
||||
println(data.toHexString())
|
||||
}
|
||||
```
|
||||
|
||||
Hashing a data
|
||||
|
||||
```swift
|
||||
let hash = data.md5()
|
||||
let hash = data.sha1()
|
||||
let hash = data.sha224()
|
||||
let hash = data.sha256()
|
||||
let hash = data.sha384()
|
||||
let hash = data.sha512()
|
||||
|
||||
let crc = data.crc32()
|
||||
|
||||
println(hash.toHexString())
|
||||
```
|
||||
|
||||
Hashing a String and printing result
|
||||
|
||||
```swift
|
||||
if let hash = "123".md5() {
|
||||
println(hash)
|
||||
}
|
||||
```
|
||||
|
||||
Some content-encryption algorithms assume the input length is a multiple of k octets, where k is greater than one. For such algorithms, the input shall be padded.
|
||||
|
||||
```swift
|
||||
let paddedData = PKCS7().add(bytes, AES.blockSize)
|
||||
```
|
||||
|
||||
Working with Ciphers
|
||||
|
||||
ChaCha20
|
||||
|
||||
```swift
|
||||
let encrypted = Cipher.ChaCha20(key: key, iv: iv).encrypt(message)
|
||||
let decrypted = Cipher.ChaCha20(key: key, iv: iv).decrypt(encrypted)
|
||||
```
|
||||
|
||||
AES
|
||||
|
||||
Notice regarding padding: *Manual padding of data is optional and CryptoSwift by default always will add PKCS7 padding before encryption, and remove after decryption when __Cipher__ enum is used. If you need manually disable/enable padding, you can do this by setting parameter for encrypt()/decrypt() on class __AES__.*
|
||||
|
||||
```swift
|
||||
|
||||
// 1. set key and random IV
|
||||
let key = [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00] as [UInt8]
|
||||
let iv = Cipher.randomIV(AES.blockSize)
|
||||
|
||||
// 2. encrypt
|
||||
let encrypted = AES(key: key, iv: iv, blockMode: .CBC)?.encrypt(message, padding: PKCS7())
|
||||
|
||||
// 3. decrypt with the same key and IV
|
||||
let decrypted = AES(key: key, iv: iv, blockMode: .CBC)?.decrypt(encryptedData, padding: PKCS7())
|
||||
|
||||
```
|
||||
|
||||
AES without data padding
|
||||
|
||||
```swift
|
||||
let encrypted = Cipher.AES(key: key, iv: iv, blockMode: .CBC).encrypt(plaintext)
|
||||
```
|
||||
|
||||
Using extensions
|
||||
|
||||
```swift
|
||||
let encrypted = dataToEncrypt.encrypt(Cipher.ChaCha20(key: key, iv: iv))
|
||||
let decrypted = encrypted.decrypt(Cipher.ChaCha20(key: key, iv: iv))
|
||||
```
|
||||
|
||||
Message authenticators
|
||||
|
||||
```swift
|
||||
// Calculate Message Authentication Code (MAC) for message
|
||||
let mac = Authenticator.Poly1305(key: key).authenticate(message)
|
||||
```
|
||||
|
||||
#####Conversion between NSData and [UInt8]
|
||||
|
||||
For you convenience CryptoSwift provide two function to easily convert array of bytes to NSData and other way around:
|
||||
|
||||
```swift
|
||||
let data = NSData.withBytes([0x01,0x02,0x03])
|
||||
let bytes:[UInt8] = data.arrayOfBytes()
|
||||
```
|
||||
|
||||
##Author
|
||||
[Marcin Krzyżanowski](http://www.krzyzanowskim.com)
|
||||
|
||||
T: [@krzyzanowskim](http://twitter.com/krzyzanowskim)
|
||||
|
||||
##License
|
||||
|
||||
Copyright (C) 2014 Marcin Krzyżanowski <marcin.krzyzanowski@gmail.com>
|
||||
This software is provided 'as-is', without any express or implied warranty.
|
||||
|
||||
In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
- The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation is required.
|
||||
- Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
- This notice may not be removed or altered from any source or binary distribution.
|
||||
|
||||
##Changelog
|
||||
|
||||
0.0.16
|
||||
- Critical fix for private "md5" selector issue (#135)
|
||||
|
||||
0.0.15
|
||||
- Fix 32-bit CTR block mode
|
||||
- Carthage support update
|
||||
- Mark as App-Extension-Safe API
|
||||
|
||||
0.0.14
|
||||
- hexString -> toHextString() #105
|
||||
- CTR (Counter mode)
|
||||
- Hex string is lowercase now
|
||||
- Carthage support
|
||||
- Tests update
|
||||
- Swift 2.0 support - overall update
|
|
@ -1,37 +0,0 @@
|
|||
# OS X Finder
|
||||
.DS_Store
|
||||
|
||||
# Xcode per-user config
|
||||
*.mode1
|
||||
*.mode1v3
|
||||
*.mode2v3
|
||||
*.perspective
|
||||
*.perspectivev3
|
||||
*.pbxuser
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
|
||||
# Build products
|
||||
build/
|
||||
*.o
|
||||
*.LinkFileList
|
||||
*.hmap
|
||||
|
||||
# Automatic backup files
|
||||
*~.nib/
|
||||
*.swp
|
||||
*~
|
||||
*.dat
|
||||
*.dep
|
||||
|
||||
# Cocoapods
|
||||
Pods
|
||||
|
||||
# Carthage
|
||||
Carthage/Build
|
||||
|
||||
test/fuzzingserver.json
|
||||
test/reports/
|
||||
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -1,109 +0,0 @@
|
|||
#<img src="https://tidwall.github.com/SwiftWebSocket/logo.png" height="45" width="60"> SwiftWebSocket
|
||||
|
||||
<a href="https://tidwall.github.io/SwiftWebSocket/results/"><img src="https://tidwall.github.io/SwiftWebSocket/build.png" alt="" width="93" height="20" border="0" /></a>
|
||||
<a href="https://developer.apple.com/swift/"><img src="https://tidwall.github.io/SwiftWebSocket/swift2.png" alt="" width="65" height="20" border="0" /></a>
|
||||
|
||||
|
||||
Conforming WebSocket ([RFC 6455](https://tools.ietf.org/html/rfc6455)) client library implemented in pure Swift.
|
||||
|
||||
[Test results for SwiftWebSocket](https://tidwall.github.io/SwiftWebSocket/results/). You can compare to the popular [Objective-C Library](http://square.github.io/SocketRocket/results/)
|
||||
|
||||
SwiftWebSocket currently passes all 521 of the Autobahn's fuzzing tests, including strict UTF-8, and message compression.
|
||||
|
||||
**Built for Swift 2.0** - For Swift 1.2 support use the 'swift/1.2' branch.
|
||||
|
||||
## Features
|
||||
|
||||
- Swift 2.0. No need for Objective-C Bridging.
|
||||
- Reads compressed messages (`permessage-deflate`). [IETF Draft](https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression-21)
|
||||
- Strict UTF-8 processing.
|
||||
- The API is modeled after the [Javascript API](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket).
|
||||
- TLS / WSS support.
|
||||
- `binaryType` property to choose between `[UInt8]` or `NSData` messages.
|
||||
- Zero asserts. All networking, stream, and protocol errors are routed through the `error` event.
|
||||
- Send pings and receive pong events.
|
||||
- High performance.
|
||||
|
||||
##Example
|
||||
|
||||
```swift
|
||||
func echoTest(){
|
||||
var messageNum = 0
|
||||
let ws = WebSocket("wss://echo.websocket.org")
|
||||
let send : ()->() = {
|
||||
let msg = "\(++messageNum): \(NSDate().description)"
|
||||
print("send: \(msg)")
|
||||
ws.send(msg)
|
||||
}
|
||||
ws.event.open = {
|
||||
print("opened")
|
||||
send()
|
||||
}
|
||||
ws.event.close = { code, reason, clean in
|
||||
print("close")
|
||||
}
|
||||
ws.event.error = { error in
|
||||
print("error \(error)")
|
||||
}
|
||||
ws.event.message = { message in
|
||||
if let text = message as? String {
|
||||
print("recv: \(text)")
|
||||
if messageNum == 10 {
|
||||
ws.close()
|
||||
} else {
|
||||
send()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##Installation (iOS and OS X)
|
||||
|
||||
### [Carthage]
|
||||
|
||||
[Carthage]: https://github.com/Carthage/Carthage
|
||||
|
||||
Add the following to your Cartfile:
|
||||
|
||||
```
|
||||
github "tidwall/SwiftWebSocket"
|
||||
```
|
||||
|
||||
Then run `carthage update`.
|
||||
|
||||
Follow the current instructions in [Carthage's README][carthage-installation]
|
||||
for up to date installation instructions.
|
||||
|
||||
[carthage-installation]: https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
|
||||
|
||||
The `import SwiftWebSocket` directive is required in order to access SwiftWebSocket features.
|
||||
|
||||
### [CocoaPods]
|
||||
|
||||
[CocoaPods]: http://cocoapods.org
|
||||
|
||||
Add the following to your [Podfile](http://guides.cocoapods.org/using/the-podfile.html):
|
||||
|
||||
```ruby
|
||||
use_frameworks!
|
||||
pod 'SwiftWebSocket'
|
||||
```
|
||||
|
||||
Then run `pod install` with CocoaPods 0.36 or newer.
|
||||
|
||||
The `import SwiftWebSocket` directive is required in order to access SwiftWebSocket features.
|
||||
|
||||
###Manually
|
||||
|
||||
Copy the `SwiftWebSocket\WebSocket.swift` file into your project.
|
||||
You must also add the `libz.dylib` library. `Project -> Target -> Build Phases -> Link Binary With Libraries`
|
||||
|
||||
There is no need for `import SwiftWebSocket` when manually installing.
|
||||
|
||||
## Contact
|
||||
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
||||
|
||||
## License
|
||||
|
||||
The SwiftWebSocket source code is available under the MIT License.
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2015 ONcast, LLC. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,19 +0,0 @@
|
|||
//
|
||||
// SwiftWebSocket.h
|
||||
// SwiftWebSocket
|
||||
//
|
||||
// Created by Josh Baker on 6/4/15.
|
||||
// Copyright (c) 2015 ONcast, LLC. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SwiftWebSocket.
|
||||
FOUNDATION_EXPORT double SwiftWebSocketVersionNumber;
|
||||
|
||||
//! Project version string for SwiftWebSocket.
|
||||
FOUNDATION_EXPORT const unsigned char SwiftWebSocketVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <SwiftWebSocket/PublicHeader.h>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -1,17 +0,0 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "SwiftWebSocket"
|
||||
s.version = "2.1.0"
|
||||
s.summary = "A high performance WebSocket client library for Swift."
|
||||
s.homepage = "https://github.com/tidwall/SwiftWebSocket"
|
||||
s.license = { :type => "Attribution License", :file => "LICENSE" }
|
||||
s.source = { :git => "https://github.com/tidwall/SwiftWebSocket.git", :tag => "v#{s.version}" }
|
||||
s.authors = { 'Josh Baker' => 'joshbaker77@gmail.com' }
|
||||
s.social_media_url = "https://twitter.com/tidwall"
|
||||
s.ios.platform = :ios, '8.0'
|
||||
s.ios.deployment_target = "8.0"
|
||||
s.osx.platform = :osx, '10.10'
|
||||
s.osx.deployment_target = "10.10"
|
||||
s.source_files = "Source/*.swift"
|
||||
s.requires_arc = true
|
||||
s.libraries = 'z'
|
||||
end
|
|
@ -1,416 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
031967101B4D96C40033860E /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03285D2A1B4A9F1A0078A1AA /* WebSocket.swift */; };
|
||||
03285D2B1B4A9F1A0078A1AA /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03285D2A1B4A9F1A0078A1AA /* WebSocket.swift */; };
|
||||
03D1E7221B208A5C00AC49AC /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 03D1E7211B208A5C00AC49AC /* libz.dylib */; };
|
||||
D71948F51B35E5670015C529 /* SwiftWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = D71948F11B35E5670015C529 /* SwiftWebSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D719491A1B35E6640015C529 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D71948FA1B35E59D0015C529 /* libz.dylib */; };
|
||||
D719491B1B35E7510015C529 /* SwiftWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = D71948F11B35E5670015C529 /* SwiftWebSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0319670F1B4D96B80033860E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
03285D2A1B4A9F1A0078A1AA /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebSocket.swift; sourceTree = "<group>"; };
|
||||
03D1E7031B20897100AC49AC /* SwiftWebSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftWebSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
03D1E7211B208A5C00AC49AC /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
|
||||
D71948F11B35E5670015C529 /* SwiftWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwiftWebSocket.h; sourceTree = "<group>"; };
|
||||
D71948FA1B35E59D0015C529 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib/libz.dylib; sourceTree = DEVELOPER_DIR; };
|
||||
D71949011B35E6130015C529 /* SwiftWebSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftWebSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
03D1E6FF1B20897100AC49AC /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03D1E7221B208A5C00AC49AC /* libz.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D71948FD1B35E6130015C529 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D719491A1B35E6640015C529 /* libz.dylib in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
03D1E6F91B20897100AC49AC = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D71948FA1B35E59D0015C529 /* libz.dylib */,
|
||||
03D1E7211B208A5C00AC49AC /* libz.dylib */,
|
||||
D71948F01B35E5670015C529 /* Source */,
|
||||
03D1E7041B20897100AC49AC /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
03D1E7041B20897100AC49AC /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
03D1E7031B20897100AC49AC /* SwiftWebSocket.framework */,
|
||||
D71949011B35E6130015C529 /* SwiftWebSocket.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D71948F01B35E5670015C529 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0319670F1B4D96B80033860E /* Info.plist */,
|
||||
D71948F11B35E5670015C529 /* SwiftWebSocket.h */,
|
||||
03285D2A1B4A9F1A0078A1AA /* WebSocket.swift */,
|
||||
);
|
||||
path = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
03D1E7001B20897100AC49AC /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D71948F51B35E5670015C529 /* SwiftWebSocket.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D71948FE1B35E6130015C529 /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D719491B1B35E7510015C529 /* SwiftWebSocket.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
03D1E7021B20897100AC49AC /* SwiftWebSocket-iOS */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 03D1E7191B20897100AC49AC /* Build configuration list for PBXNativeTarget "SwiftWebSocket-iOS" */;
|
||||
buildPhases = (
|
||||
03D1E6FE1B20897100AC49AC /* Sources */,
|
||||
03D1E6FF1B20897100AC49AC /* Frameworks */,
|
||||
03D1E7001B20897100AC49AC /* Headers */,
|
||||
03D1E7011B20897100AC49AC /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SwiftWebSocket-iOS";
|
||||
productName = SwiftWebSocket;
|
||||
productReference = 03D1E7031B20897100AC49AC /* SwiftWebSocket.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
D71949001B35E6130015C529 /* SwiftWebSocket-OSX */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = D71949141B35E6160015C529 /* Build configuration list for PBXNativeTarget "SwiftWebSocket-OSX" */;
|
||||
buildPhases = (
|
||||
D71948FC1B35E6130015C529 /* Sources */,
|
||||
D71948FD1B35E6130015C529 /* Frameworks */,
|
||||
D71948FE1B35E6130015C529 /* Headers */,
|
||||
D71948FF1B35E6130015C529 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "SwiftWebSocket-OSX";
|
||||
productName = "SwiftWebSocket-OSX";
|
||||
productReference = D71949011B35E6130015C529 /* SwiftWebSocket.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
03D1E6FA1B20897100AC49AC /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "ONcast, LLC";
|
||||
TargetAttributes = {
|
||||
03D1E7021B20897100AC49AC = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
};
|
||||
D71949001B35E6130015C529 = {
|
||||
CreatedOnToolsVersion = 6.3.2;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 03D1E6FD1B20897100AC49AC /* Build configuration list for PBXProject "SwiftWebSocket" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = 03D1E6F91B20897100AC49AC;
|
||||
productRefGroup = 03D1E7041B20897100AC49AC /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
03D1E7021B20897100AC49AC /* SwiftWebSocket-iOS */,
|
||||
D71949001B35E6130015C529 /* SwiftWebSocket-OSX */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
03D1E7011B20897100AC49AC /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D71948FF1B35E6130015C529 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
03D1E6FE1B20897100AC49AC /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
03285D2B1B4A9F1A0078A1AA /* WebSocket.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
D71948FC1B35E6130015C529 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
031967101B4D96C40033860E /* WebSocket.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
03D1E7171B20897100AC49AC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
03D1E7181B20897100AC49AC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
03D1E71A1B20897100AC49AC /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Source/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.oncast.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftWebSocket;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
03D1E71B1B20897100AC49AC /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
INFOPLIST_FILE = Source/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.oncast.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftWebSocket;
|
||||
SKIP_INSTALL = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
D71949151B35E6160015C529 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Source/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.oncast.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftWebSocket;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
D71949161B35E6160015C529 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_VERSION = A;
|
||||
INFOPLIST_FILE = Source/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.oncast.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = SwiftWebSocket;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
VALID_ARCHS = x86_64;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
03D1E6FD1B20897100AC49AC /* Build configuration list for PBXProject "SwiftWebSocket" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
03D1E7171B20897100AC49AC /* Debug */,
|
||||
03D1E7181B20897100AC49AC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
03D1E7191B20897100AC49AC /* Build configuration list for PBXNativeTarget "SwiftWebSocket-iOS" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
03D1E71A1B20897100AC49AC /* Debug */,
|
||||
03D1E71B1B20897100AC49AC /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
D71949141B35E6160015C529 /* Build configuration list for PBXNativeTarget "SwiftWebSocket-OSX" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
D71949151B35E6160015C529 /* Debug */,
|
||||
D71949161B35E6160015C529 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 03D1E6FA1B20897100AC49AC /* Project object */;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:SwiftWebSocket.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -1,80 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "03D1E7021B20897100AC49AC"
|
||||
BuildableName = "SwiftWebSocket.framework"
|
||||
BlueprintName = "SwiftWebSocket-iOS"
|
||||
ReferencedContainer = "container:SwiftWebSocket.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "Debug">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Debug"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "03D1E7021B20897100AC49AC"
|
||||
BuildableName = "SwiftWebSocket.framework"
|
||||
BlueprintName = "SwiftWebSocket-iOS"
|
||||
ReferencedContainer = "container:SwiftWebSocket.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "03D1E7021B20897100AC49AC"
|
||||
BuildableName = "SwiftWebSocket.framework"
|
||||
BlueprintName = "SwiftWebSocket-iOS"
|
||||
ReferencedContainer = "container:SwiftWebSocket.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,286 +0,0 @@
|
|||
import Foundation
|
||||
|
||||
let baseURL = "ws://localhost:9001"
|
||||
let agent = "SwiftWebSocket"
|
||||
let debug = false
|
||||
let keepStatsUpdated = false
|
||||
let stopOnFailure = false
|
||||
let stopOnInfo = false
|
||||
let stopAfterOne = false
|
||||
let showDuration = false
|
||||
|
||||
let startCase = 1
|
||||
let stopAtCase = 999
|
||||
|
||||
private enum ErrCode : Int, CustomStringConvertible {
|
||||
case Protocol = 1002, Payload = 1007, Undefined = -100, Codepoint = -101, Library = -102, Socket = -103
|
||||
var description : String {
|
||||
switch self {
|
||||
case Protocol: return "Protocol error"
|
||||
case Payload: return "Invalid payload data"
|
||||
case Codepoint: return "Invalid codepoint"
|
||||
case Library: return "Library error"
|
||||
case Undefined: return "Undefined error"
|
||||
case Socket: return "Broken socket"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func makeError(error : String, _ code: ErrCode) -> ErrorType {
|
||||
return NSError(domain: "com.github.tidwall.WebSocketConn", code: code.rawValue, userInfo: [NSLocalizedDescriptionKey:"\(error)"])
|
||||
}
|
||||
private func makeError(error : ErrorType, _ code: ErrCode) -> ErrorType {
|
||||
let err = error as NSError
|
||||
return NSError(domain: err.domain, code: code.rawValue, userInfo: [NSLocalizedDescriptionKey:"\(err.localizedDescription)"])
|
||||
}
|
||||
private func makeError(error : String) -> ErrorType {
|
||||
return makeError(error, ErrCode.Library)
|
||||
}
|
||||
|
||||
private func jsonObject(text : String) throws -> [String: AnyObject] {
|
||||
if let data = text.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false),
|
||||
let json = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers) as? [String : AnyObject] {
|
||||
return json
|
||||
}
|
||||
throw makeError("not json")
|
||||
}
|
||||
|
||||
// autobahn api
|
||||
func getCaseCount(block:(count : Int, error : ErrorType?)->()){
|
||||
let ws = WebSocket(baseURL + "/getCaseCount")
|
||||
ws.event.message = { (msg) in
|
||||
if let text = msg as? String {
|
||||
ws.close()
|
||||
if let i = Int(text) {
|
||||
block(count: i, error: nil)
|
||||
} else {
|
||||
block(count: 0, error: makeError("invalid response"))
|
||||
}
|
||||
}
|
||||
}
|
||||
ws.event.error = { error in
|
||||
block(count: 0, error: error)
|
||||
}
|
||||
}
|
||||
|
||||
func getCaseInfo(caseIdx : Int, block :(id : String, description : String, error : ErrorType?)->()){
|
||||
let ws = WebSocket(baseURL + "/getCaseInfo?case=\(caseIdx+1)")
|
||||
ws.event.message = { (msg) in
|
||||
if let text = msg as? String {
|
||||
ws.close()
|
||||
do {
|
||||
let json = try jsonObject(text)
|
||||
if json["id"] == nil || json["description"] == nil {
|
||||
block(id: "", description: "", error: makeError("invalid response"))
|
||||
}
|
||||
block(id: json["id"] as! String, description: json["description"] as! String, error: nil)
|
||||
} catch {
|
||||
block(id: "", description: "", error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
ws.event.error = { error in
|
||||
block(id: "", description: "", error: error)
|
||||
}
|
||||
}
|
||||
|
||||
func getCaseStatus(caseIdx : Int, block : (error : ErrorType?)->()){
|
||||
var responseText = ""
|
||||
let ws = WebSocket(baseURL + "/getCaseStatus?case=\(caseIdx+1)&agent=\(agent)")
|
||||
ws.event.error = { error in
|
||||
block(error: error)
|
||||
}
|
||||
ws.event.message = { (msg) in
|
||||
if let text = msg as? String {
|
||||
responseText = text
|
||||
ws.close()
|
||||
}
|
||||
}
|
||||
ws.event.close = { (code, reason, clean) in
|
||||
do {
|
||||
let json = try jsonObject(responseText)
|
||||
if let behavior = json["behavior"] as? String {
|
||||
if behavior == "OK" {
|
||||
block(error: nil)
|
||||
} else if behavior == "FAILED"{
|
||||
block(error: makeError(""))
|
||||
} else {
|
||||
block(error: makeError(behavior))
|
||||
}
|
||||
return
|
||||
}
|
||||
} catch {
|
||||
block(error: error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateReports(echo: Bool = false, block : ()->()){
|
||||
var success = false
|
||||
let ws = WebSocket(baseURL + "/updateReports?agent=\(agent)")
|
||||
ws.event.close = { (code, reason, clean) in
|
||||
if echo {
|
||||
if !success{
|
||||
print("[ERR] reports failed to update")
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
block()
|
||||
}
|
||||
ws.event.open = {
|
||||
ws.close()
|
||||
success = true
|
||||
}
|
||||
}
|
||||
|
||||
func runCase(caseIdx : Int, caseCount : Int, block : (error : ErrorType?)->()) {
|
||||
// var start = NSDate().timeIntervalSince1970
|
||||
// var evstart = NSTimeInterval(0)
|
||||
getCaseInfo(caseIdx, block: { (id, description, error) in
|
||||
if error != nil{
|
||||
print("[ERR] getCaseInfo failed: \(error!)\n")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
var next = { ()->() in }
|
||||
|
||||
|
||||
print("[CASE] #\(caseIdx+1)/\(caseCount): \(id): \(description)")
|
||||
let failed : (message : String)->() = { (message) in
|
||||
let error = makeError(message)
|
||||
printFailure(error)
|
||||
if stopOnFailure {
|
||||
block(error: error)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
let warn : (message : String)->() = { (message) in
|
||||
printFailure(makeError(message))
|
||||
}
|
||||
next = { ()->() in
|
||||
// if showDuration {
|
||||
// let now = NSDate().timeIntervalSince1970
|
||||
// let recv = evstart == 0 ? 0 : (evstart - start) * 1000
|
||||
// let total = (now - start) * 1000
|
||||
// let send = total - recv
|
||||
// println("[DONE] %.0f ms (recv: %.0f ms, send: %.0f ms)", total, recv, send)
|
||||
// }
|
||||
getCaseStatus(caseIdx){ error in
|
||||
let f : ()->() = {
|
||||
if let error = error as? NSError {
|
||||
if error.localizedDescription == "INFORMATIONAL" {
|
||||
if stopOnInfo {
|
||||
failed(message : error.localizedDescription)
|
||||
return
|
||||
}
|
||||
} else if stopOnFailure {
|
||||
failed(message : error.localizedDescription)
|
||||
return
|
||||
}
|
||||
warn(message : error.localizedDescription)
|
||||
}
|
||||
if caseIdx+1 == caseCount || stopAfterOne || (caseIdx+1 == stopAtCase){
|
||||
block(error: nil)
|
||||
} else {
|
||||
runCase(caseIdx+1, caseCount: caseCount, block: block)
|
||||
}
|
||||
}
|
||||
if keepStatsUpdated || caseIdx % 10 == 0 {
|
||||
updateReports(false, block: f)
|
||||
} else {
|
||||
f()
|
||||
}
|
||||
}
|
||||
}
|
||||
var responseError : ErrorType?
|
||||
//print(baseURL + "/runCase?case=\(caseIdx+1)&agent=\(agent)")
|
||||
let ws = WebSocket(baseURL + "/runCase?case=\(caseIdx+1)&agent=\(agent)")
|
||||
ws.eventQueue = nil
|
||||
ws.binaryType = .UInt8UnsafeBufferPointer
|
||||
|
||||
if id.hasPrefix("13.") || id.hasPrefix("12.") {
|
||||
ws.compression.on = true
|
||||
if id.hasPrefix("13.1"){
|
||||
ws.compression.noContextTakeover = false
|
||||
ws.compression.maxWindowBits = 0
|
||||
}
|
||||
if id.hasPrefix("13.2"){
|
||||
ws.compression.noContextTakeover = true
|
||||
ws.compression.maxWindowBits = 0
|
||||
}
|
||||
if id.hasPrefix("13.3"){
|
||||
ws.compression.noContextTakeover = false
|
||||
ws.compression.maxWindowBits = 8
|
||||
}
|
||||
if id.hasPrefix("13.4"){
|
||||
ws.compression.noContextTakeover = false
|
||||
ws.compression.maxWindowBits = 15
|
||||
}
|
||||
if id.hasPrefix("13.5"){
|
||||
ws.compression.noContextTakeover = true
|
||||
ws.compression.maxWindowBits = 8
|
||||
}
|
||||
if id.hasPrefix("13.6"){
|
||||
ws.compression.noContextTakeover = true
|
||||
ws.compression.maxWindowBits = 15
|
||||
}
|
||||
if id.hasPrefix("13.7"){
|
||||
ws.compression.noContextTakeover = true
|
||||
ws.compression.maxWindowBits = 8
|
||||
}
|
||||
}
|
||||
ws.event.end = { (code, reason, clean, error) in
|
||||
responseError = error
|
||||
if responseError == nil {
|
||||
next()
|
||||
} else {
|
||||
var message = ""
|
||||
if let error = responseError as? NSError {
|
||||
message += error.localizedDescription
|
||||
}
|
||||
if code != 0 {
|
||||
message += " with code '\(code)' and reason '\(reason)'"
|
||||
}
|
||||
failed(message: message)
|
||||
}
|
||||
}
|
||||
ws.event.message = { (msg) in
|
||||
// evstart = NSDate().timeIntervalSince1970
|
||||
ws.send(msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
func printFailure(error : ErrorType?){
|
||||
let error = error as? NSError
|
||||
if error == nil || error!.localizedDescription == "" {
|
||||
print("[ERR] FAILED")
|
||||
exit(1)
|
||||
} else {
|
||||
if error!.localizedDescription == "INFORMATIONAL" {
|
||||
//printinfo("INFORMATIONAL")
|
||||
} else {
|
||||
print("[ERR] FAILED: \(error!.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getCaseCount { (count, error) in
|
||||
if error != nil{
|
||||
print("[ERR] getCaseCount failed: \(error!)")
|
||||
exit(1)
|
||||
}
|
||||
runCase(startCase-1, caseCount: count){ (error) in
|
||||
if error == nil{
|
||||
updateReports(true){
|
||||
exit(0)
|
||||
}
|
||||
} else {
|
||||
updateReports(true){
|
||||
exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSRunLoop.mainRunLoop().run()
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
|
||||
git checkout gh-pages
|
||||
cleanup() {
|
||||
git checkout master
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ -f "reports/build.png" ]; then
|
||||
cp -rf reports/build.png ../build.png
|
||||
git add ../build.png
|
||||
fi
|
||||
if [ -d "reports/clients/" ]; then
|
||||
cp -rf reports/clients/ ../results/
|
||||
git add ../results/
|
||||
fi
|
||||
git commit -m 'updated result'
|
||||
git push
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.4 KiB |
|
@ -1,46 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd $(dirname "${BASH_SOURCE[0]}")
|
||||
WSTEST=$(ls $HOME/Library/Python/2.*/bin/wstest 2>/dev/null)
|
||||
set -e
|
||||
if [ ! -f "$WSTEST" ] || [ "$UPGRADE" == "1" ]; then
|
||||
pip install --user --upgrade unittest2
|
||||
pip install --user --upgrade autobahntestsuite
|
||||
WSTEST=$(ls $HOME/Library/Python/2.*/bin/wstest)
|
||||
fi
|
||||
if [ "$SERVER" == "1" ]; then
|
||||
$WSTEST -m fuzzingserver
|
||||
exit
|
||||
fi
|
||||
if [ "$CLIENT" != "1" ]; then
|
||||
$WSTEST -m fuzzingserver &
|
||||
WSTEST_PID=$!
|
||||
cleanup() {
|
||||
kill $WSTEST_PID
|
||||
if [ "$SUCCESS" == "1" ]; then
|
||||
cp -f res/passing.png reports/build.png
|
||||
printf "\033[0;32m[SUCCESS]\033[0m\n"
|
||||
else
|
||||
if [ -d "reports/clients/" ]; then
|
||||
cp -f res/failing.png reports/build.png
|
||||
printf "\033[0;31m[FAILURE]\033[0m\n"
|
||||
else
|
||||
printf "\033[0;31m[FAILURE]\033[0m Cancelled Early\n"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
printf "\033[0;33mDon't forget to run 'test/gh-pages.sh' to process the results.\033[0m\n"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
sleep 1
|
||||
fi
|
||||
printf "\033[0;33m[BUILDING]\033[0m\n"
|
||||
rm -fr reports
|
||||
mkdir -p reports
|
||||
mkdir -p /tmp/SwiftWebSocket/tests
|
||||
|
||||
cat ../Source/WebSocket.swift > /tmp/SwiftWebSocket/tests/main.swift
|
||||
echo "" >> /tmp/SwiftWebSocket/tests/main.swift
|
||||
cat autobahn.swift >> /tmp/SwiftWebSocket/tests/main.swift
|
||||
swift -Ounchecked /tmp/SwiftWebSocket/tests/main.swift
|
||||
SUCCESS=1
|
|
@ -1,3 +0,0 @@
|
|||
pkg/
|
||||
bin/
|
||||
src/
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export GOPATH=$(cd $(dirname "${BASH_SOURCE[0]}"); pwd)
|
||||
cd $GOPATH
|
||||
|
||||
go get "github.com/gorilla/websocket"
|
||||
go run server.go
|
|
@ -1,76 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/gorilla/websocket"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/client", client)
|
||||
http.HandleFunc("/echo", socket)
|
||||
log.Print("Running server on port 6789")
|
||||
log.Print("ws://localhost:6789/client (javascript test client)")
|
||||
log.Print("ws://localhost:6789/echo (echo socket)")
|
||||
http.ListenAndServe(":6789", nil)
|
||||
}
|
||||
|
||||
func socket(w http.ResponseWriter, r *http.Request) {
|
||||
log.Print("connection established")
|
||||
ws, err := websocket.Upgrade(w, r, nil, 1024, 1024)
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
ws.Close()
|
||||
log.Print("connection closed")
|
||||
}()
|
||||
|
||||
for {
|
||||
msgt, msg, err := ws.ReadMessage()
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
return
|
||||
}
|
||||
log.Print("rcvd: '" + string(msg) + "'")
|
||||
ws.WriteMessage(msgt, msg)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
func client(w http.ResponseWriter, r *http.Request) {
|
||||
log.Print("client request")
|
||||
w.Header().Set("Content-Type", "text/html")
|
||||
w.Write([]byte(`
|
||||
Open the Javascript Console
|
||||
<script>
|
||||
var messageNum = 0;
|
||||
var ws = new WebSocket("ws://localhost:6789/echo")
|
||||
function send(){
|
||||
messageNum++;
|
||||
var msg = messageNum + ": " + new Date()
|
||||
console.log("send: " + msg)
|
||||
ws.send(msg)
|
||||
}
|
||||
ws.onopen = function(){
|
||||
console.log("opened")
|
||||
send()
|
||||
}
|
||||
ws.onclose = function(){
|
||||
console.log("close")
|
||||
}
|
||||
ws.onerror = function(ev){
|
||||
console.log("error " + ev)
|
||||
}
|
||||
ws.onmessage = function(msg){
|
||||
console.log("recv: " + msg.data)
|
||||
if (messageNum == 10) {
|
||||
ws.close()
|
||||
} else {
|
||||
send()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
`))
|
||||
}
|
|
@ -1,228 +0,0 @@
|
|||
#########################
|
||||
# .gitignore file for Xcode4 and Xcode5 Source projects
|
||||
#
|
||||
# Apple bugs, waiting for Apple to fix/respond:
|
||||
#
|
||||
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
|
||||
#
|
||||
# Version 2.6
|
||||
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
|
||||
#
|
||||
# 2015 updates:
|
||||
# - Fixed typo in "xccheckout" line - thanks to @lyck for pointing it out!
|
||||
# - Fixed the .idea optional ignore. Thanks to @hashier for pointing this out
|
||||
# - Finally added "xccheckout" to the ignore. Apple still refuses to answer support requests about this, but in practice it seems you should ignore it.
|
||||
# - minor tweaks from Jona and Coeur (slightly more precise xc* filtering/names)
|
||||
# 2014 updates:
|
||||
# - appended non-standard items DISABLED by default (uncomment if you use those tools)
|
||||
# - removed the edit that an SO.com moderator made without bothering to ask me
|
||||
# - researched CocoaPods .lock more carefully, thanks to Gokhan Celiker
|
||||
# 2013 updates:
|
||||
# - fixed the broken "save personal Schemes"
|
||||
# - added line-by-line explanations for EVERYTHING (some were missing)
|
||||
#
|
||||
# NB: if you are storing "built" products, this WILL NOT WORK,
|
||||
# and you should use a different .gitignore (or none at all)
|
||||
# This file is for SOURCE projects, where there are many extra
|
||||
# files that we want to exclude
|
||||
#
|
||||
#########################
|
||||
|
||||
#####
|
||||
# OS X temporary files that should never be committed
|
||||
#
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.DS_Store
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
.Trashes
|
||||
|
||||
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
|
||||
|
||||
*.swp
|
||||
|
||||
#
|
||||
# *.lock - this is used and abused by many editors for many different things.
|
||||
# For the main ones I use (e.g. Eclipse), it should be excluded
|
||||
# from source-control, but YMMV.
|
||||
# (lock files are usually local-only file-synchronization on the local FS that should NOT go in git)
|
||||
# c.f. the "OPTIONAL" section at bottom though, for tool-specific variations!
|
||||
#
|
||||
# In particular, if you're using CocoaPods, you'll want to comment-out this line:
|
||||
*.lock
|
||||
|
||||
|
||||
#
|
||||
# profile - REMOVED temporarily (on double-checking, I can't find it in OS X docs?)
|
||||
#profile
|
||||
|
||||
|
||||
####
|
||||
# Xcode temporary files that should never be committed
|
||||
#
|
||||
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...
|
||||
|
||||
*~.nib
|
||||
|
||||
|
||||
####
|
||||
# Xcode build files -
|
||||
#
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"
|
||||
|
||||
DerivedData/
|
||||
|
||||
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"
|
||||
|
||||
build/
|
||||
|
||||
|
||||
#####
|
||||
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
|
||||
#
|
||||
# This is complicated:
|
||||
#
|
||||
# SOMETIMES you need to put this file in version control.
|
||||
# Apple designed it poorly - if you use "custom executables", they are
|
||||
# saved in this file.
|
||||
# 99% of projects do NOT use those, so they do NOT want to version control this file.
|
||||
# ..but if you're in the 1%, comment out the line "*.pbxuser"
|
||||
|
||||
# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html
|
||||
|
||||
*.pbxuser
|
||||
|
||||
# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode1v3
|
||||
|
||||
# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html
|
||||
|
||||
*.mode2v3
|
||||
|
||||
# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file
|
||||
|
||||
*.perspectivev3
|
||||
|
||||
# NB: also, whitelist the default ones, some projects need to use these
|
||||
!default.pbxuser
|
||||
!default.mode1v3
|
||||
!default.mode2v3
|
||||
!default.perspectivev3
|
||||
|
||||
|
||||
####
|
||||
# Xcode 4 - semi-personal settings
|
||||
#
|
||||
# Apple Shared data that Apple put in the wrong folder
|
||||
# c.f. http://stackoverflow.com/a/19260712/153422
|
||||
# FROM ANSWER: Apple says "don't ignore it"
|
||||
# FROM COMMENTS: Apple is wrong; Apple code is too buggy to trust; there are no known negative side-effects to ignoring Apple's unofficial advice and instead doing the thing that actively fixes bugs in Xcode
|
||||
# Up to you, but ... current advice: ignore it.
|
||||
*.xccheckout
|
||||
|
||||
#
|
||||
#
|
||||
# OPTION 1: ---------------------------------
|
||||
# throw away ALL personal settings (including custom schemes!
|
||||
# - unless they are "shared")
|
||||
# As per build/ and DerivedData/, this ought to have a trailing slash
|
||||
#
|
||||
# NB: this is exclusive with OPTION 2 below
|
||||
xcuserdata/
|
||||
|
||||
# OPTION 2: ---------------------------------
|
||||
# get rid of ALL personal settings, but KEEP SOME OF THEM
|
||||
# - NB: you must manually uncomment the bits you want to keep
|
||||
#
|
||||
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
|
||||
# or manually install git over the top of the OS X version
|
||||
# NB: this is exclusive with OPTION 1 above
|
||||
#
|
||||
#xcuserdata/**/*
|
||||
|
||||
# (requires option 2 above): Personal Schemes
|
||||
#
|
||||
#!xcuserdata/**/xcschemes/*
|
||||
|
||||
####
|
||||
# XCode 4 workspaces - more detailed
|
||||
#
|
||||
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
|
||||
#
|
||||
# Workspace layout is quite spammy. For reference:
|
||||
#
|
||||
# /(root)/
|
||||
# /(project-name).xcodeproj/
|
||||
# project.pbxproj
|
||||
# /project.xcworkspace/
|
||||
# contents.xcworkspacedata
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# UserInterfaceState.xcuserstate
|
||||
# /xcshareddata/
|
||||
# /xcschemes/
|
||||
# (shared scheme name).xcscheme
|
||||
# /xcuserdata/
|
||||
# /(your name)/xcuserdatad/
|
||||
# (private scheme).xcscheme
|
||||
# xcschememanagement.plist
|
||||
#
|
||||
#
|
||||
|
||||
####
|
||||
# Xcode 4 - Deprecated classes
|
||||
#
|
||||
# Allegedly, if you manually "deprecate" your classes, they get moved here.
|
||||
#
|
||||
# We're using source-control, so this is a "feature" that we do not want!
|
||||
|
||||
*.moved-aside
|
||||
|
||||
####
|
||||
# OPTIONAL: Some well-known tools that people use side-by-side with Xcode / iOS development
|
||||
#
|
||||
# NB: I'd rather not include these here, but gitignore's design is weak and doesn't allow
|
||||
# modular gitignore: you have to put EVERYTHING in one file.
|
||||
#
|
||||
# COCOAPODS:
|
||||
#
|
||||
# c.f. http://guides.cocoapods.org/using/using-cocoapods.html#what-is-a-podfilelock
|
||||
# c.f. http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
|
||||
#
|
||||
!Podfile.lock
|
||||
#
|
||||
# RUBY:
|
||||
#
|
||||
# c.f. http://yehudakatz.com/2010/12/16/clarifying-the-roles-of-the-gemspec-and-gemfile/
|
||||
#
|
||||
!Gemfile.lock
|
||||
#
|
||||
# IDEA:
|
||||
#
|
||||
# c.f. https://www.jetbrains.com/objc/help/managing-projects-under-version-control.html?search=workspace.xml
|
||||
#
|
||||
.idea/workspace.xml
|
||||
#
|
||||
# TEXTMATE:
|
||||
#
|
||||
# -- UNVERIFIED: c.f. http://stackoverflow.com/a/50283/153422
|
||||
#
|
||||
#tm_build_errors
|
||||
|
||||
####
|
||||
# UNKNOWN: recommended by others, but I can't discover what these files are
|
||||
#
|
||||
|
||||
#### Dave Wood additions
|
||||
# Other source code version systems
|
||||
.hg
|
||||
.svn
|
||||
CVS
|
||||
|
||||
# Sensitive files
|
||||
.ssh/*
|
||||
id_rsa*
|
||||
id_dsa*
|
|
@ -1 +0,0 @@
|
|||
../../../../Carthage/Build
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Dave Wood, Cerebral Gardens http://www.cerebralgardens.com/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,211 +0,0 @@
|
|||
#XCGLogger
|
||||
#####By: Dave Wood
|
||||
- Cerebral Gardens http://www.cerebralgardens.com/
|
||||
- Twitter: [@DaveWoodX](https://twitter.com/DaveWoodX)
|
||||
|
||||
###tl;dr
|
||||
A debug log module for use in Swift projects. Allows you to log details to the console (and optionally a file), just like you would have with NSLog or println, but with additional information, such as the date, function name, filename and line number.
|
||||
|
||||
Go from this:
|
||||
|
||||
```Simple message```
|
||||
|
||||
to this:
|
||||
|
||||
```2014-06-09 06:44:43.600 [Debug] [AppDelegate.swift:40] application(_:didFinishLaunchingWithOptions:): Simple message```
|
||||
|
||||
###Compatibility
|
||||
|
||||
XCGLogger works in both iOS and OS X projects. It is a Swift library intended for use in Swift projects.
|
||||
|
||||
Swift does away with the C preprocessor, which kills the ability to use ```#define``` macros. This means our traditional way of generating nice debug logs is dead. Resorting to just plain old ```println``` calls means you lose a lot of helpful information, or requires you to type a lot more code.
|
||||
|
||||
Use XCGLogger version 3.x for Swift 2.0, XCGLogger version 2.x for Swift 1.2, and XCGLogger version 1.x for Swift 1.1 and below.
|
||||
|
||||
###Communication _(Hat Tip AlamoFire)_
|
||||
|
||||
* If you need help, use Stack Overflow. (Tag '[xcglogger](http://stackoverflow.com/questions/tagged/xcglogger)')
|
||||
* If you'd like to ask a general question, use [Stack Overflow](http://stackoverflow.com/questions/tagged/xcglogger).
|
||||
* If you found a bug, open an issue.
|
||||
* If you have a feature request, open an issue.
|
||||
* If you want to contribute, submit a pull request.
|
||||
|
||||
###How to Use
|
||||
|
||||
Add the XCGLogger project as a subproject to your project, and add either the iOS or OS X library as a dependancy of your target(s).
|
||||
Under the General tab of your target, add the XCGLogger.framework to the Embedded Binaries.
|
||||
|
||||
Then, in each source file:
|
||||
|
||||
```Swift
|
||||
import XCGLogger
|
||||
```
|
||||
|
||||
In your AppDelegate, declare a global constant to the default XCGLogger instance.
|
||||
|
||||
```Swift
|
||||
let log = XCGLogger.defaultInstance()
|
||||
```
|
||||
|
||||
**Note**: previously this was ```XCGLogger.sharedInstance()```, but it was changed to better reflect that you can create multiple instances.
|
||||
|
||||
In the
|
||||
```Swift
|
||||
application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) // iOS
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```Swift
|
||||
applicationDidFinishLaunching(aNotification: NSNotification) // OS X
|
||||
```
|
||||
|
||||
function, configure the options you need:
|
||||
|
||||
```Swift
|
||||
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: "path/to/file", fileLogLevel: .Debug)
|
||||
```
|
||||
|
||||
The value for ```writeToFile:``` can be a ```String``` or ```NSURL```. If the file already exists, it will be cleared before we use it. Omit a value or set it to ```nil``` to log to the console only. You can optionally set a different log level for the file output using the ```fileLogLevel``` parameter. Set it to ```nil``` or omit it to use the same log level as the console.
|
||||
|
||||
Then, whenever you'd like to log something, use one of the convenience methods:
|
||||
|
||||
```Swift
|
||||
log.verbose("A verbose message, usually useful when working on a specific problem")
|
||||
log.debug("A debug message")
|
||||
log.info("An info message, probably useful to power users looking in console.app")
|
||||
log.warning("A warning message, may indicate a possible error")
|
||||
log.error("An error occurred, but it's recoverable, just info about what happened")
|
||||
log.severe("A severe error occurred, we are likely about to crash now")
|
||||
```
|
||||
|
||||
The different methods set the log level of the message. XCGLogger will only print messages with a log level that is >= its current log level setting.
|
||||
|
||||
###Advanced Use
|
||||
|
||||
It's possible to create multiple instances of XCGLogger with different options. For example, you only want to log a specific section of your app to a file, perhaps to diagnose a specific issue a user is seeing. In that case, create alternate instances like this:
|
||||
|
||||
```Swift
|
||||
let fileLog = XCGLogger()
|
||||
fileLog.setup(.None, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: "path/to/file", fileLogLevel: .Debug)
|
||||
fileLog.info("Have a second instance for special use")
|
||||
```
|
||||
|
||||
You can create alternate log destinations (besides the two built in ones for the console and a file). Your custom log destination must implement the ```XCGLogDestinationProtocol``` protocol. Instantiate your object, configure it, and then add it to the ```XCGLogger``` object with ```addLogDestination```. Take a look at ```XCGConsoleLogDestination``` and ```XCGFileLogDestination``` for examples.
|
||||
|
||||
Each log destination can have its own log level. Setting the log level on the log object itself will pass that level to each destination. Then set the destinations that need to be different.
|
||||
|
||||
#####Selectively Executing Code
|
||||
|
||||
As of version 1.9, all log methods operate on closures. Using the same syntactic sugar as Swift's ```assert()``` function, this approach ensures we don't waste resources building log messages that won't be printed anyway, while at the same time preserving a clean call site.
|
||||
|
||||
For example, the following log statement won't waste resources if the debug log level is suppressed:
|
||||
|
||||
```Swift
|
||||
log.debug("The description of \(thisObject) is really expensive to create")
|
||||
```
|
||||
|
||||
Similarly, let's say you have to iterate through a loop in order to do some calculation before logging the result. In Objective-C, you could put that code block between ```#if``` ```#endif```, and prevent the code from running. But in Swift, previously you would need to still process that loop, wasting resources. With ```XCGLogger``` it's as simple as:
|
||||
|
||||
```Swift
|
||||
log.debug {
|
||||
var total = 0.0
|
||||
for receipt in receipts {
|
||||
total += receipt.total
|
||||
}
|
||||
|
||||
return "Total of all receipts: \(total)"
|
||||
}
|
||||
```
|
||||
|
||||
In cases where you wish to selectively execute code without generating a log line, you can use the methods: ```verboseExec```, ```debugExec```, ```infoExec```, ```warningExec```, ```errorExec```, and ```severeExec```.
|
||||
|
||||
#####Custom Date Formats
|
||||
|
||||
As of version 2.0, you can create your own NSDateFormatter object and assign it to the logger.
|
||||
|
||||
```Swift
|
||||
let dateFormatter = NSDateFormatter()
|
||||
dateFormatter.dateFormat = "MM/dd/yyyy hh:mma"
|
||||
dateFormatter.locale = NSLocale.currentLocale()
|
||||
log.dateFormatter = dateFormatter
|
||||
```
|
||||
|
||||
#####Enhancing log messages with colour
|
||||
|
||||
XCGLogger now supports the XcodeColors plug-in (https://github.com/robbiehanson/XcodeColors). Once installed, each log level will have its own colour. These colours can be customized as desired. See the sample projects for examples. If using multiple logger's, you could alternatively set each logger to its own colour.
|
||||
|
||||
#####Initialization using Closure
|
||||
|
||||
Alternatively you can use a closure to initialize your global variable, so that all initialization is done in one place
|
||||
```Swift
|
||||
let log: XCGLogger = {
|
||||
let log = XCGLogger.defaultInstance()
|
||||
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil, fileLogLevel: .Debug)
|
||||
|
||||
let dateFormatter = NSDateFormatter()
|
||||
dateFormatter.dateFormat = "MM/dd/yyyy hh:mma"
|
||||
dateFormatter.locale = NSLocale.currentLocale()
|
||||
log.dateFormatter = dateFormatter
|
||||
|
||||
return log
|
||||
}()
|
||||
```
|
||||
|
||||
#####Alternate Configurations
|
||||
|
||||
By using Swift build flags, different log levels can be used in debugging versus staging/production.
|
||||
Go to Build settings -> Swift Compiler - Custom Flags -> Other Swift Flags and add ```-DDEBUG``` to the Debug entry.
|
||||
|
||||
```Swift
|
||||
#if DEBUG
|
||||
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil)
|
||||
#else
|
||||
log.setup(.Severe, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: nil)
|
||||
#endif
|
||||
```
|
||||
|
||||
You can set any number of options up in a similar fashion. See the updated iOSDemo app for an example of using different log destinations based on options, search for ```USE_NSLOG```.
|
||||
|
||||
|
||||
###To Do
|
||||
|
||||
- Add more examples of some advanced use cases
|
||||
- Add additional log destination types
|
||||
- Add Objective-C support
|
||||
- Add log file rotation options
|
||||
|
||||
###More
|
||||
|
||||
If you find this library helpful, you'll definitely find these other tools helpful:
|
||||
|
||||
Watchdog: http://watchdogforxcode.com/
|
||||
Slender: http://martiancraft.com/products/slender
|
||||
Briefs: http://giveabrief.com/
|
||||
|
||||
Also, please check out my book **Swift for the Really Impatient** http://swiftforthereallyimpatient.com/
|
||||
|
||||
###Change Log
|
||||
|
||||
* **Version 3.0**: *(2015/09/09)* - Bug fix, and WatchOS 2 suppport (thanks @ymyzk)
|
||||
* **Version 2.4**: *(2015/09/09)* - Minor bug fix, likely the last release for Swift 1.x
|
||||
* **Version 3.0b3**: *(2015/08/24)* - Added option to include the log identifier in log messages #79
|
||||
* **Version 2.3**: *(2015/08/24)* - Added option to include the log identifier in log messages #79
|
||||
* **Version 3.0b2**: *(2015/08/11)* - Updated for Swift 2.0 (Xcode 7 Beta 5)
|
||||
* **Version 2.2**: *(2015/08/11)* - Internal restructuring, easier to create new log destination subclasses. Can disable function names, and/or dates. Added optional new log destination that uses NSLog instead of println().
|
||||
* **Version 3.0b1**: *(2015/06/18)* - Swift 2.0 support/required. Consider this unstable for now, as Swift 2.0 will likely see changes before final release, and this library may undergo some architecture changes (time permitting).
|
||||
* **Version 2.1.1**: *(2015/06/18)* - Fixed two minor bugs wrt XcodeColors.
|
||||
* **Version 2.1**: *(2015/06/17)* - Added support for XcodeColors (https://github.com/robbiehanson/XcodeColors). Undeprecated the \*Exec() methods.
|
||||
* **Version 2.0**: *(2015/04/14)* - Requires Swift 1.2. Removed some workarounds/hacks for older versions of Xcode. Removed thread based caching of NSDateFormatter objects since they're now thread safe. You can now use the default date formatter, or create and assign your own and it'll be used. Added Thread name option (Thanks to Nick Strecker https://github.com/tekknick ). Add experimental support for CocoaPods.
|
||||
* **Version 1.9**: *(2015/04/14)* - Deprecated the \*Exec() methods in favour of just using a trailing closure on the logging methods (Thanks to Nick Strecker https://github.com/tekknick ). This will be the last version for Swift 1.1.
|
||||
* **Version 1.8.1**: *(2014/12/31)* - Added a workaround to the Swift compiler's optimization bug, restored optimization level back to Fastest
|
||||
* **Version 1.8**: *(2014/11/16)* - Added warning log level (Issue #16)
|
||||
* **Version 1.7**: *(2014/09/27)* - Reorganized to be used as a subproject instead of a framework, fixed threading
|
||||
* **Version 1.6**: *(2014/09/09)* - Updated for Xcode 6.1 Beta 1
|
||||
* **Version 1.5**: *(2014/08/23)* - Updated for Xcode 6 Beta 6
|
||||
* **Version 1.4**: *(2014/08/04)* - Updated for Xcode 6 Beta 5, removed `__FUNCTION__` workaround
|
||||
* **Version 1.3**: *(2014/07/27)* - Updated to use public/internal/private access modifiers
|
||||
* **Version 1.2**: *(2014/07/01)* - Added exec methods to selectively execute code
|
||||
* **Version 1.1**: *(2014/06/22)* - Changed the internal architecture to allow for more flexibility
|
||||
* **Version 1.0**: *(2014/06/09)* - Initial Release
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 275 KiB |
|
@ -1,27 +0,0 @@
|
|||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = "XCGLogger"
|
||||
s.version = "3.0"
|
||||
s.summary = "A debug log module for use in Swift projects."
|
||||
|
||||
s.description = <<-DESC
|
||||
Allows you to log details to the console (and optionally a file), just like you would have with NSLog or println, but with additional information, such as the date, function name, filename and line number.
|
||||
DESC
|
||||
s.homepage = "https://github.com/DaveWoodCom/XCGLogger"
|
||||
|
||||
s.license = { :type => "MIT", :file => "LICENSE.txt" }
|
||||
s.author = { "Dave Wood" => "cocoapods@cerebralgardens.com" }
|
||||
s.social_media_url = "http://twitter.com/DaveWoodX"
|
||||
s.platforms = { :ios => "7.0", :watchos => "2.0" }
|
||||
|
||||
s.source = { :git => "https://github.com/DaveWoodCom/XCGLogger.git", :tag => "Version_3.0" }
|
||||
s.source_files = "XCGLogger/Library/XCGLogger/XCGLogger.swift"
|
||||
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.osx.deployment_target = '10.9'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
|
||||
s.framework = "Foundation"
|
||||
s.requires_arc = true
|
||||
|
||||
end
|
|
@ -1,565 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
553EEA9019FF86A200EE60AF /* XCGLogger.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 555FFCD719D77B3400F62246 /* XCGLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
555FFCB319D77B1800F62246 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 555FFCB219D77B1800F62246 /* AppDelegate.swift */; };
|
||||
555FFCB519D77B1800F62246 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 555FFCB419D77B1800F62246 /* Images.xcassets */; };
|
||||
555FFCB819D77B1800F62246 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 555FFCB619D77B1800F62246 /* MainMenu.xib */; };
|
||||
555FFCC419D77B1800F62246 /* OSXDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 555FFCC319D77B1800F62246 /* OSXDemoTests.swift */; };
|
||||
55D5C34A19D77C9B00A47D22 /* XCGLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 555FFCD719D77B3400F62246 /* XCGLogger.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
553EEA9119FF86A200EE60AF /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 554DF41619D76FE7005708BE;
|
||||
remoteInfo = "XCGLogger (OS X)";
|
||||
};
|
||||
555CA5E41BA1120A00A5AA95 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 70CB94201B99E728007802FF;
|
||||
remoteInfo = "XCGLogger (watchOS)";
|
||||
};
|
||||
555FFCBE19D77B1800F62246 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCA519D77B1800F62246 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 555FFCAC19D77B1800F62246;
|
||||
remoteInfo = OSXDemo;
|
||||
};
|
||||
555FFCD419D77B3400F62246 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55E3EE4519D76F280068C3A7;
|
||||
remoteInfo = XCGLogger;
|
||||
};
|
||||
555FFCD619D77B3400F62246 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 554DF41719D76FE7005708BE;
|
||||
remoteInfo = "XCGLogger (OS X)";
|
||||
};
|
||||
555FFCD819D77B3400F62246 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55E3EE5019D76F280068C3A7;
|
||||
remoteInfo = XCGLoggerTests;
|
||||
};
|
||||
5562CA961B7B25DD00F36DD8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55BB1F011B79DC7500709779;
|
||||
remoteInfo = "XCGLoggerTests (OS X)";
|
||||
};
|
||||
55D5C34819D77C6000A47D22 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 554DF41619D76FE7005708BE;
|
||||
remoteInfo = "XCGLogger (OS X)";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
553EEA9319FF86A200EE60AF /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
553EEA9019FF86A200EE60AF /* XCGLogger.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
555FFCAD19D77B1800F62246 /* OSXDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OSXDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
555FFCB119D77B1800F62246 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
555FFCB219D77B1800F62246 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
555FFCB419D77B1800F62246 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
555FFCB719D77B1800F62246 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
555FFCBD19D77B1800F62246 /* OSXDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OSXDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
555FFCC219D77B1800F62246 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
555FFCC319D77B1800F62246 /* OSXDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSXDemoTests.swift; sourceTree = "<group>"; };
|
||||
555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = XCGLogger.xcodeproj; path = ../../../../Library/XCGLogger.xcodeproj; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
555FFCAA19D77B1800F62246 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
55D5C34A19D77C9B00A47D22 /* XCGLogger.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
555FFCBA19D77B1800F62246 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
555FFCA419D77B1800F62246 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCAF19D77B1800F62246 /* OSXDemo */,
|
||||
555FFCC019D77B1800F62246 /* OSXDemoTests */,
|
||||
555FFCAE19D77B1800F62246 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCAE19D77B1800F62246 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCAD19D77B1800F62246 /* OSXDemo.app */,
|
||||
555FFCBD19D77B1800F62246 /* OSXDemoTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCAF19D77B1800F62246 /* OSXDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCB219D77B1800F62246 /* AppDelegate.swift */,
|
||||
555FFCB419D77B1800F62246 /* Images.xcassets */,
|
||||
555FFCB619D77B1800F62246 /* MainMenu.xib */,
|
||||
555FFCCD19D77B2300F62246 /* Libraries */,
|
||||
555FFCB019D77B1800F62246 /* Supporting Files */,
|
||||
);
|
||||
path = OSXDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCB019D77B1800F62246 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCB119D77B1800F62246 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCC019D77B1800F62246 /* OSXDemoTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCC319D77B1800F62246 /* OSXDemoTests.swift */,
|
||||
555FFCC119D77B1800F62246 /* Supporting Files */,
|
||||
);
|
||||
path = OSXDemoTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCC119D77B1800F62246 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCC219D77B1800F62246 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCCD19D77B2300F62246 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */,
|
||||
);
|
||||
name = Libraries;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
555FFCCF19D77B3400F62246 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
555FFCD519D77B3400F62246 /* XCGLogger.framework */,
|
||||
555FFCD719D77B3400F62246 /* XCGLogger.framework */,
|
||||
555CA5E51BA1120A00A5AA95 /* XCGLogger.framework */,
|
||||
555FFCD919D77B3400F62246 /* XCGLoggerTests (iOS).xctest */,
|
||||
5562CA971B7B25DD00F36DD8 /* XCGLoggerTests (OS X).xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
555FFCAC19D77B1800F62246 /* OSXDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 555FFCC719D77B1800F62246 /* Build configuration list for PBXNativeTarget "OSXDemo" */;
|
||||
buildPhases = (
|
||||
555FFCA919D77B1800F62246 /* Sources */,
|
||||
555FFCAA19D77B1800F62246 /* Frameworks */,
|
||||
555FFCAB19D77B1800F62246 /* Resources */,
|
||||
553EEA9319FF86A200EE60AF /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
55D5C34919D77C6000A47D22 /* PBXTargetDependency */,
|
||||
553EEA9219FF86A200EE60AF /* PBXTargetDependency */,
|
||||
);
|
||||
name = OSXDemo;
|
||||
productName = OSXDemo;
|
||||
productReference = 555FFCAD19D77B1800F62246 /* OSXDemo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
555FFCBC19D77B1800F62246 /* OSXDemoTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 555FFCCA19D77B1800F62246 /* Build configuration list for PBXNativeTarget "OSXDemoTests" */;
|
||||
buildPhases = (
|
||||
555FFCB919D77B1800F62246 /* Sources */,
|
||||
555FFCBA19D77B1800F62246 /* Frameworks */,
|
||||
555FFCBB19D77B1800F62246 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
555FFCBF19D77B1800F62246 /* PBXTargetDependency */,
|
||||
);
|
||||
name = OSXDemoTests;
|
||||
productName = OSXDemoTests;
|
||||
productReference = 555FFCBD19D77B1800F62246 /* OSXDemoTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
555FFCA519D77B1800F62246 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Cerebral Gardens";
|
||||
TargetAttributes = {
|
||||
555FFCAC19D77B1800F62246 = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
};
|
||||
555FFCBC19D77B1800F62246 = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
TestTargetID = 555FFCAC19D77B1800F62246;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 555FFCA819D77B1800F62246 /* Build configuration list for PBXProject "OSXDemo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 555FFCA419D77B1800F62246;
|
||||
productRefGroup = 555FFCAE19D77B1800F62246 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 555FFCCF19D77B3400F62246 /* Products */;
|
||||
ProjectRef = 555FFCCE19D77B3400F62246 /* XCGLogger.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
555FFCAC19D77B1800F62246 /* OSXDemo */,
|
||||
555FFCBC19D77B1800F62246 /* OSXDemoTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
555CA5E51BA1120A00A5AA95 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 555CA5E41BA1120A00A5AA95 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
555FFCD519D77B3400F62246 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 555FFCD419D77B3400F62246 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
555FFCD719D77B3400F62246 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 555FFCD619D77B3400F62246 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
555FFCD919D77B3400F62246 /* XCGLoggerTests (iOS).xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = "XCGLoggerTests (iOS).xctest";
|
||||
remoteRef = 555FFCD819D77B3400F62246 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
5562CA971B7B25DD00F36DD8 /* XCGLoggerTests (OS X).xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = "XCGLoggerTests (OS X).xctest";
|
||||
remoteRef = 5562CA961B7B25DD00F36DD8 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
555FFCAB19D77B1800F62246 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
555FFCB519D77B1800F62246 /* Images.xcassets in Resources */,
|
||||
555FFCB819D77B1800F62246 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
555FFCBB19D77B1800F62246 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
555FFCA919D77B1800F62246 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
555FFCB319D77B1800F62246 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
555FFCB919D77B1800F62246 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
555FFCC419D77B1800F62246 /* OSXDemoTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
553EEA9219FF86A200EE60AF /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "XCGLogger (OS X)";
|
||||
targetProxy = 553EEA9119FF86A200EE60AF /* PBXContainerItemProxy */;
|
||||
};
|
||||
555FFCBF19D77B1800F62246 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 555FFCAC19D77B1800F62246 /* OSXDemo */;
|
||||
targetProxy = 555FFCBE19D77B1800F62246 /* PBXContainerItemProxy */;
|
||||
};
|
||||
55D5C34919D77C6000A47D22 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "XCGLogger (OS X)";
|
||||
targetProxy = 55D5C34819D77C6000A47D22 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
555FFCB619D77B1800F62246 /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
555FFCB719D77B1800F62246 /* Base */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
555FFCC519D77B1800F62246 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.0;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
555FFCC619D77B1800F62246 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 3.0;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.9;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
555FFCC819D77B1800F62246 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = OSXDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.osxdemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
555FFCC919D77B1800F62246 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = OSXDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.osxdemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
555FFCCB19D77B1800F62246 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = OSXDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.osxdemo.tests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OSXDemo.app/Contents/MacOS/OSXDemo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
555FFCCC19D77B1800F62246 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = OSXDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.osxdemo.tests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/OSXDemo.app/Contents/MacOS/OSXDemo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
555FFCA819D77B1800F62246 /* Build configuration list for PBXProject "OSXDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
555FFCC519D77B1800F62246 /* Debug */,
|
||||
555FFCC619D77B1800F62246 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
555FFCC719D77B1800F62246 /* Build configuration list for PBXNativeTarget "OSXDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
555FFCC819D77B1800F62246 /* Debug */,
|
||||
555FFCC919D77B1800F62246 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
555FFCCA19D77B1800F62246 /* Build configuration list for PBXNativeTarget "OSXDemoTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
555FFCCB19D77B1800F62246 /* Debug */,
|
||||
555FFCCC19D77B1800F62246 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 555FFCA519D77B1800F62246 /* Project object */;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:OSXDemo.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -1,138 +0,0 @@
|
|||
//
|
||||
// AppDelegate.swift
|
||||
// XCGLogger: https://github.com/DaveWoodCom/XCGLogger
|
||||
//
|
||||
// Created by Dave Wood on 2014-06-06.
|
||||
// Copyright (c) 2014 Dave Wood, Cerebral Gardens.
|
||||
// Some rights reserved: https://github.com/DaveWoodCom/XCGLogger/blob/master/LICENSE.txt
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import XCGLogger
|
||||
|
||||
let appDelegate = NSApplication.sharedApplication().delegate as! AppDelegate
|
||||
let log: XCGLogger = {
|
||||
// Setup XCGLogger
|
||||
let log = XCGLogger.defaultInstance()
|
||||
let logPath: NSString = ("~/Desktop/XCGLogger_Log.txt" as NSString).stringByExpandingTildeInPath
|
||||
log.xcodeColors = [
|
||||
.Verbose: .lightGrey,
|
||||
.Debug: .darkGrey,
|
||||
.Info: .darkGreen,
|
||||
.Warning: .orange,
|
||||
.Error: XCGLogger.XcodeColor(fg: NSColor.redColor(), bg: NSColor.whiteColor()), // Optionally use an NSColor
|
||||
.Severe: XCGLogger.XcodeColor(fg: (255, 255, 255), bg: (255, 0, 0)) // Optionally use RGB values directly
|
||||
]
|
||||
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: logPath)
|
||||
|
||||
return log
|
||||
}()
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
@IBOutlet var window: NSWindow!
|
||||
|
||||
@IBOutlet var logLevelTextField: NSTextField!
|
||||
@IBOutlet var currentLogLevelTextField: NSTextField!
|
||||
@IBOutlet var generateTestLogTextField: NSTextField!
|
||||
@IBOutlet var logLevelSlider: NSSlider!
|
||||
|
||||
// MARK: - Life cycle methods
|
||||
func applicationDidFinishLaunching(aNotification: NSNotification) {
|
||||
// Insert code here to initialize your application
|
||||
updateView()
|
||||
}
|
||||
|
||||
func applicationWillTerminate(aNotification: NSNotification) {
|
||||
// Insert code here to tear down your application
|
||||
}
|
||||
|
||||
// MARK: - Main View
|
||||
@IBAction func verboseButtonTouchUpInside(sender: AnyObject) {
|
||||
log.verbose("Verbose button tapped")
|
||||
log.verbose {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed verbose code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func debugButtonTouchUpInside(sender: AnyObject) {
|
||||
log.debug("Debug button tapped")
|
||||
log.debug {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed debug code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func infoButtonTouchUpInside(sender: AnyObject) {
|
||||
log.info("Info button tapped")
|
||||
log.info {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed info code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func warningButtonTouchUpInside(sender: AnyObject) {
|
||||
log.warning("Warning button tapped")
|
||||
log.warning {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed warning code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func errorButtonTouchUpInside(sender: AnyObject) {
|
||||
log.error("Error button tapped")
|
||||
log.error {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed error code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func severeButtonTouchUpInside(sender: AnyObject) {
|
||||
log.severe("Severe button tapped")
|
||||
log.severe {
|
||||
// add expensive code required only for logging, then return an optional String
|
||||
return "Executed severe code block" // or nil
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func logLevelSliderValueChanged(sender: AnyObject) {
|
||||
var logLevel: XCGLogger.LogLevel = .Verbose
|
||||
|
||||
if (0 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 1) {
|
||||
logLevel = .Verbose
|
||||
}
|
||||
else if (1 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 2) {
|
||||
logLevel = .Debug
|
||||
}
|
||||
else if (2 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 3) {
|
||||
logLevel = .Info
|
||||
}
|
||||
else if (3 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 4) {
|
||||
logLevel = .Warning
|
||||
}
|
||||
else if (4 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 5) {
|
||||
logLevel = .Error
|
||||
}
|
||||
else if (5 <= logLevelSlider.floatValue && logLevelSlider.floatValue < 6) {
|
||||
logLevel = .Severe
|
||||
}
|
||||
else {
|
||||
logLevel = .None
|
||||
}
|
||||
|
||||
log.outputLogLevel = logLevel
|
||||
updateView()
|
||||
}
|
||||
|
||||
func updateView() {
|
||||
logLevelSlider.floatValue = Float(log.outputLogLevel.rawValue)
|
||||
currentLogLevelTextField.stringValue = "\(log.outputLogLevel)"
|
||||
}
|
||||
}
|
||||
|
||||
func noop() {
|
||||
// Global no operation function, useful for doing nothing in a switch option, and examples
|
||||
}
|
|
@ -1,280 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="OSXDemo" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="currentLogLevelTextField" destination="N7c-0c-rmu" id="YT6-zm-ffe"/>
|
||||
<outlet property="generateTestLogTextField" destination="4Bc-zj-lM9" id="Qti-fk-tNx"/>
|
||||
<outlet property="logLevelSlider" destination="jgm-VS-e8T" id="Zoi-8C-ZNb"/>
|
||||
<outlet property="logLevelTextField" destination="ucO-Qd-aGf" id="fVt-b5-f7W"/>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
|
||||
<items>
|
||||
<menuItem title="OSX Demo" id="1Xt-HY-uBw" userLabel="Menu Item - OSX Demo">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="OSX Demo" systemMenu="apple" id="uQy-DD-JDr">
|
||||
<items>
|
||||
<menuItem title="About OSX Demo" id="5kV-Vb-QxS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
|
||||
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
|
||||
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
|
||||
<menuItem title="Services" id="NMo-om-nkz">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
|
||||
<menuItem title="Hide OSX Demo" keyEquivalent="h" id="Olw-nP-bQN">
|
||||
<connections>
|
||||
<action selector="hide:" target="-1" id="PnN-Uc-m68"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
|
||||
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
|
||||
<connections>
|
||||
<action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Show All" id="Kd2-mp-pUS">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
|
||||
<menuItem title="Quit OSX Demo" keyEquivalent="q" id="4sb-4s-VLi">
|
||||
<connections>
|
||||
<action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
<menuItem title="Window" id="aUF-d1-5bR">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
|
||||
<items>
|
||||
<menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
|
||||
<connections>
|
||||
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Zoom" id="R4o-n2-Eq4">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
|
||||
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
</menuItem>
|
||||
</items>
|
||||
</menu>
|
||||
<window title="OSX Demo" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="335" y="390" width="500" height="433"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="500" height="433"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ucO-Qd-aGf">
|
||||
<rect key="frame" x="18" y="396" width="115" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="FOO-Fw-iPD"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Current Log Level" id="eqM-oM-IJ3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4Bc-zj-lM9">
|
||||
<rect key="frame" x="18" y="346" width="464" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="8Hh-2Q-Tf1"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Generate Test Log" id="CX9-bW-BA3">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N7c-0c-rmu">
|
||||
<rect key="frame" x="137" y="396" width="345" height="17"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="gMX-YL-FgI"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Debug" id="gMs-fY-ZUK">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jgm-VS-e8T">
|
||||
<rect key="frame" x="18" y="369" width="464" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="17" id="1Qr-Lp-utg"/>
|
||||
</constraints>
|
||||
<sliderCell key="cell" state="on" alignment="left" maxValue="6" doubleValue="1" tickMarkPosition="above" allowsTickMarkValuesOnly="YES" sliderType="linear" id="HQH-Oa-kJz"/>
|
||||
<connections>
|
||||
<action selector="logLevelSliderValueChanged:" target="Voe-Tx-rLC" id="f3m-Xk-MXz"/>
|
||||
</connections>
|
||||
</slider>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="Oqt-uH-bUP">
|
||||
<rect key="frame" x="18" y="305" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="FhI-Xm-6Vl"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Verbose" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="18u-Vb-PCy">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="verboseButtonTouchUpInside:" target="Voe-Tx-rLC" id="9hc-ad-GGO"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="cJV-r2-NVU">
|
||||
<rect key="frame" x="18" y="267" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="fSI-1p-gR3"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Debug" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="K0h-57-yYI">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="debugButtonTouchUpInside:" target="Voe-Tx-rLC" id="0Ks-GC-c0W"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="Bmd-xL-cy5">
|
||||
<rect key="frame" x="18" y="229" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="ZVa-47-nds"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Info" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="DNU-dG-7NA">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="infoButtonTouchUpInside:" target="Voe-Tx-rLC" id="JvO-oT-qop"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="PvH-ob-p5o">
|
||||
<rect key="frame" x="18" y="191" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="c9F-HU-aLF"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Warning" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="43E-4m-3wn">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="warningButtonTouchUpInside:" target="Voe-Tx-rLC" id="zcb-yS-gTA"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="lxL-cx-amI">
|
||||
<rect key="frame" x="18" y="153" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="cWs-qq-euG"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Error" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="P3t-ee-zvy">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="errorButtonTouchUpInside:" target="Voe-Tx-rLC" id="hxV-x0-Hjj"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button translatesAutoresizingMaskIntoConstraints="NO" id="51c-ck-4h8">
|
||||
<rect key="frame" x="18" y="115" width="464" height="35"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="1zd-NB-iQA"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="bevel" title="Severe" bezelStyle="regularSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="to7-kl-Qc9">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="severeButtonTouchUpInside:" target="Voe-Tx-rLC" id="rP1-al-h6i"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="LIO-Xd-f4A">
|
||||
<rect key="frame" x="20" y="20" width="460" height="90"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="90" id="IyT-30-Vjg"/>
|
||||
</constraints>
|
||||
<textFieldCell key="cell" refusesFirstResponder="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="9rj-vS-1ZB">
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="title">XCGLogger will only log messages that are set for the same or higher log level. So when the current log level is set to Info for example, neither Verbose nor Debug logs will be displayed, but Info, Warning, Error and Severe logs will be displayed.</string>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="LIO-Xd-f4A" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="0Dg-h3-2Qc"/>
|
||||
<constraint firstItem="4Bc-zj-lM9" firstAttribute="top" secondItem="jgm-VS-e8T" secondAttribute="bottom" constant="8" symbolic="YES" id="0My-CC-9dr"/>
|
||||
<constraint firstItem="4Bc-zj-lM9" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="0zM-Ul-8G1"/>
|
||||
<constraint firstItem="lxL-cx-amI" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="1GQ-WT-1FM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="LIO-Xd-f4A" secondAttribute="bottom" constant="20" symbolic="YES" id="21X-6U-z1B"/>
|
||||
<constraint firstAttribute="trailing" secondItem="51c-ck-4h8" secondAttribute="trailing" constant="20" symbolic="YES" id="5Jk-U6-p9T"/>
|
||||
<constraint firstItem="LIO-Xd-f4A" firstAttribute="top" secondItem="51c-ck-4h8" secondAttribute="bottom" constant="8" symbolic="YES" id="AIr-f1-tiq"/>
|
||||
<constraint firstItem="ucO-Qd-aGf" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="BLL-f4-JC0"/>
|
||||
<constraint firstItem="ucO-Qd-aGf" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="DiF-aU-mgH"/>
|
||||
<constraint firstItem="jgm-VS-e8T" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="Kfk-9U-Pws"/>
|
||||
<constraint firstItem="PvH-ob-p5o" firstAttribute="top" secondItem="Bmd-xL-cy5" secondAttribute="bottom" constant="8" symbolic="YES" id="NeP-kq-PTy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="PvH-ob-p5o" secondAttribute="trailing" constant="20" symbolic="YES" id="OSh-dx-ndK"/>
|
||||
<constraint firstItem="N7c-0c-rmu" firstAttribute="leading" secondItem="ucO-Qd-aGf" secondAttribute="trailing" constant="8" symbolic="YES" id="PVQ-ik-Hvk"/>
|
||||
<constraint firstItem="51c-ck-4h8" firstAttribute="top" secondItem="lxL-cx-amI" secondAttribute="bottom" constant="8" symbolic="YES" id="Plt-0z-awf"/>
|
||||
<constraint firstItem="lxL-cx-amI" firstAttribute="top" secondItem="PvH-ob-p5o" secondAttribute="bottom" constant="8" symbolic="YES" id="PtT-VK-w2e"/>
|
||||
<constraint firstItem="cJV-r2-NVU" firstAttribute="top" secondItem="Oqt-uH-bUP" secondAttribute="bottom" constant="8" symbolic="YES" id="QC5-5M-EY8"/>
|
||||
<constraint firstItem="N7c-0c-rmu" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" constant="20" symbolic="YES" id="R6D-Q6-bqc"/>
|
||||
<constraint firstItem="PvH-ob-p5o" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="RxX-5x-srX"/>
|
||||
<constraint firstItem="Oqt-uH-bUP" firstAttribute="top" secondItem="4Bc-zj-lM9" secondAttribute="bottom" constant="8" symbolic="YES" id="YFS-ha-hQE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LIO-Xd-f4A" secondAttribute="trailing" constant="20" symbolic="YES" id="Yyw-L0-b6b"/>
|
||||
<constraint firstItem="51c-ck-4h8" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="a5s-X4-PQ6"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Bmd-xL-cy5" secondAttribute="trailing" constant="20" symbolic="YES" id="cMW-WF-6eK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jgm-VS-e8T" secondAttribute="trailing" constant="20" symbolic="YES" id="cbq-5Q-adU"/>
|
||||
<constraint firstItem="Oqt-uH-bUP" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="eZn-nT-Umi"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lxL-cx-amI" secondAttribute="trailing" constant="20" symbolic="YES" id="jWk-cb-Bp0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4Bc-zj-lM9" secondAttribute="trailing" constant="20" symbolic="YES" id="qB5-ii-973"/>
|
||||
<constraint firstItem="Bmd-xL-cy5" firstAttribute="top" secondItem="cJV-r2-NVU" secondAttribute="bottom" constant="8" symbolic="YES" id="qiG-WB-Dbd"/>
|
||||
<constraint firstItem="jgm-VS-e8T" firstAttribute="top" secondItem="N7c-0c-rmu" secondAttribute="bottom" constant="8" symbolic="YES" id="th5-HX-sic"/>
|
||||
<constraint firstAttribute="trailing" secondItem="cJV-r2-NVU" secondAttribute="trailing" constant="20" symbolic="YES" id="tvh-hq-Zow"/>
|
||||
<constraint firstItem="cJV-r2-NVU" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="uWz-hu-Tvp"/>
|
||||
<constraint firstItem="Bmd-xL-cy5" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" constant="20" symbolic="YES" id="v6X-O5-ElS"/>
|
||||
<constraint firstAttribute="trailing" secondItem="N7c-0c-rmu" secondAttribute="trailing" constant="20" symbolic="YES" id="vXD-aH-lU0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Oqt-uH-bUP" secondAttribute="trailing" constant="20" symbolic="YES" id="xs7-Nl-elZ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<point key="canvasLocation" x="888" y="669.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
|
@ -1,58 +0,0 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>6</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014 Cerebral Gardens. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// OSXDemoTests.swift
|
||||
// OSXDemoTests
|
||||
//
|
||||
// Created by Dave Wood on 2014-09-27.
|
||||
// Copyright (c) 2014 Cerebral Gardens. All rights reserved.
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
import XCTest
|
||||
|
||||
class OSXDemoTests: XCTestCase {
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
// This is an example of a functional test case.
|
||||
XCTAssert(true, "Pass")
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measureBlock() {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,893 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
553EEA8719FF860800EE60AF /* XCGLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 558C64AF19D777B100D6D507 /* XCGLogger.framework */; };
|
||||
553EEA8819FF860800EE60AF /* XCGLogger.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 558C64AF19D777B100D6D507 /* XCGLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
558C648819D7770100D6D507 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558C648719D7770100D6D507 /* AppDelegate.swift */; };
|
||||
558C648A19D7770100D6D507 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558C648919D7770100D6D507 /* ViewController.swift */; };
|
||||
558C648D19D7770100D6D507 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 558C648B19D7770100D6D507 /* Main.storyboard */; };
|
||||
558C648F19D7770100D6D507 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 558C648E19D7770100D6D507 /* Images.xcassets */; };
|
||||
558C649219D7770100D6D507 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 558C649019D7770100D6D507 /* LaunchScreen.xib */; };
|
||||
558C649E19D7770100D6D507 /* iOSDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558C649D19D7770100D6D507 /* iOSDemoTests.swift */; };
|
||||
558EA9301BA0FCEC00848990 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 558EA92E1BA0FCEC00848990 /* Interface.storyboard */; };
|
||||
558EA9321BA0FCEC00848990 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 558EA9311BA0FCEC00848990 /* Assets.xcassets */; };
|
||||
558EA9391BA0FCEC00848990 /* watchOSDemo Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 558EA9381BA0FCEC00848990 /* watchOSDemo Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
558EA9401BA0FCEC00848990 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558EA93F1BA0FCEC00848990 /* InterfaceController.swift */; };
|
||||
558EA9421BA0FCEC00848990 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558EA9411BA0FCEC00848990 /* ExtensionDelegate.swift */; };
|
||||
558EA9441BA0FCEC00848990 /* NotificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558EA9431BA0FCEC00848990 /* NotificationController.swift */; };
|
||||
558EA9461BA0FCEC00848990 /* GlanceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 558EA9451BA0FCEC00848990 /* GlanceController.swift */; };
|
||||
558EA9481BA0FCEC00848990 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 558EA9471BA0FCEC00848990 /* Assets.xcassets */; };
|
||||
558EA94C1BA0FCEC00848990 /* watchOSDemo.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = 558EA92C1BA0FCEC00848990 /* watchOSDemo.app */; };
|
||||
558EA95B1BA0FFD400848990 /* XCGLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 558EA9561BA0FCEC00848990 /* XCGLogger.framework */; };
|
||||
558EA95C1BA0FFE500848990 /* XCGLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 558EA9561BA0FCEC00848990 /* XCGLogger.framework */; };
|
||||
558EA95D1BA0FFE500848990 /* XCGLogger.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 558EA9561BA0FCEC00848990 /* XCGLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
553EEA8919FF860800EE60AF /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 55E3EE4419D76F280068C3A7;
|
||||
remoteInfo = "XCGLogger (iOS)";
|
||||
};
|
||||
558C649819D7770100D6D507 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C647A19D7770100D6D507 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 558C648119D7770100D6D507;
|
||||
remoteInfo = iOSDemo;
|
||||
};
|
||||
558C64AE19D777B100D6D507 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55E3EE4519D76F280068C3A7;
|
||||
remoteInfo = XCGLogger;
|
||||
};
|
||||
558C64B019D777B100D6D507 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 554DF41719D76FE7005708BE;
|
||||
remoteInfo = "XCGLogger (OS X)";
|
||||
};
|
||||
558C64B219D777B100D6D507 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55E3EE5019D76F280068C3A7;
|
||||
remoteInfo = XCGLoggerTests;
|
||||
};
|
||||
558C64B419D777D100D6D507 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 55E3EE4419D76F280068C3A7;
|
||||
remoteInfo = XCGLogger;
|
||||
};
|
||||
558EA93A1BA0FCEC00848990 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C647A19D7770100D6D507 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 558EA9371BA0FCEC00848990;
|
||||
remoteInfo = "watchOSDemo Extension";
|
||||
};
|
||||
558EA94A1BA0FCEC00848990 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C647A19D7770100D6D507 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 558EA92B1BA0FCEC00848990;
|
||||
remoteInfo = watchOSDemo;
|
||||
};
|
||||
558EA9551BA0FCEC00848990 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 70CB94201B99E728007802FF;
|
||||
remoteInfo = "XCGLogger (watchOS)";
|
||||
};
|
||||
558EA95E1BA0FFE500848990 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 70CB94161B99E728007802FF;
|
||||
remoteInfo = "XCGLogger (watchOS)";
|
||||
};
|
||||
55D4395A1B7AAC16001370EC /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 55BB1F011B79DC7500709779;
|
||||
remoteInfo = "XCGLoggerTests (OS X)";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
553EEA8B19FF860900EE60AF /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
553EEA8819FF860800EE60AF /* XCGLogger.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA9581BA0FCEC00848990 /* Embed App Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
558EA9391BA0FCEC00848990 /* watchOSDemo Extension.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA95A1BA0FCEC00848990 /* Embed Watch Content */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/Watch";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
558EA94C1BA0FCEC00848990 /* watchOSDemo.app in Embed Watch Content */,
|
||||
);
|
||||
name = "Embed Watch Content";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA9601BA0FFE500848990 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
558EA95D1BA0FFE500848990 /* XCGLogger.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
558C648219D7770100D6D507 /* iOSDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
558C648619D7770100D6D507 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
558C648719D7770100D6D507 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
558C648919D7770100D6D507 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
558C648C19D7770100D6D507 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
558C648E19D7770100D6D507 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
558C649119D7770100D6D507 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
||||
558C649719D7770100D6D507 /* iOSDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iOSDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
558C649C19D7770100D6D507 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
558C649D19D7770100D6D507 /* iOSDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSDemoTests.swift; sourceTree = "<group>"; };
|
||||
558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = XCGLogger.xcodeproj; path = ../../../../Library/XCGLogger.xcodeproj; sourceTree = "<group>"; };
|
||||
558EA92C1BA0FCEC00848990 /* watchOSDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = watchOSDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
558EA92F1BA0FCEC00848990 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = "<group>"; };
|
||||
558EA9311BA0FCEC00848990 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
558EA9331BA0FCEC00848990 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
558EA9381BA0FCEC00848990 /* watchOSDemo Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "watchOSDemo Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
558EA93E1BA0FCEC00848990 /* PushNotificationPayload.apns */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushNotificationPayload.apns; sourceTree = "<group>"; };
|
||||
558EA93F1BA0FCEC00848990 /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = "<group>"; };
|
||||
558EA9411BA0FCEC00848990 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
|
||||
558EA9431BA0FCEC00848990 /* NotificationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationController.swift; sourceTree = "<group>"; };
|
||||
558EA9451BA0FCEC00848990 /* GlanceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlanceController.swift; sourceTree = "<group>"; };
|
||||
558EA9471BA0FCEC00848990 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
558EA9491BA0FCEC00848990 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
558C647F19D7770100D6D507 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
553EEA8719FF860800EE60AF /* XCGLogger.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558C649419D7770100D6D507 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA9351BA0FCEC00848990 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558EA95B1BA0FFD400848990 /* XCGLogger.framework in Frameworks */,
|
||||
558EA95C1BA0FFE500848990 /* XCGLogger.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
558C647919D7770100D6D507 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C648419D7770100D6D507 /* iOSDemo */,
|
||||
558C649A19D7770100D6D507 /* iOSDemoTests */,
|
||||
558EA92D1BA0FCEC00848990 /* watchOSDemo */,
|
||||
558EA93C1BA0FCEC00848990 /* watchOSDemo Extension */,
|
||||
558C648319D7770100D6D507 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C648319D7770100D6D507 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C648219D7770100D6D507 /* iOSDemo.app */,
|
||||
558C649719D7770100D6D507 /* iOSDemoTests.xctest */,
|
||||
558EA92C1BA0FCEC00848990 /* watchOSDemo.app */,
|
||||
558EA9381BA0FCEC00848990 /* watchOSDemo Extension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C648419D7770100D6D507 /* iOSDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C648719D7770100D6D507 /* AppDelegate.swift */,
|
||||
558C648919D7770100D6D507 /* ViewController.swift */,
|
||||
558C648B19D7770100D6D507 /* Main.storyboard */,
|
||||
558C648E19D7770100D6D507 /* Images.xcassets */,
|
||||
558C649019D7770100D6D507 /* LaunchScreen.xib */,
|
||||
558C64A719D7779900D6D507 /* Libraries */,
|
||||
558C648519D7770100D6D507 /* Supporting Files */,
|
||||
);
|
||||
path = iOSDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C648519D7770100D6D507 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C648619D7770100D6D507 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C649A19D7770100D6D507 /* iOSDemoTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C649D19D7770100D6D507 /* iOSDemoTests.swift */,
|
||||
558C649B19D7770100D6D507 /* Supporting Files */,
|
||||
);
|
||||
path = iOSDemoTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C649B19D7770100D6D507 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C649C19D7770100D6D507 /* Info.plist */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C64A719D7779900D6D507 /* Libraries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */,
|
||||
);
|
||||
name = Libraries;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C64A919D777B100D6D507 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558C64AF19D777B100D6D507 /* XCGLogger.framework */,
|
||||
558C64B119D777B100D6D507 /* XCGLogger.framework */,
|
||||
558EA9561BA0FCEC00848990 /* XCGLogger.framework */,
|
||||
558C64B319D777B100D6D507 /* XCGLoggerTests (iOS).xctest */,
|
||||
55D4395B1B7AAC16001370EC /* XCGLoggerTests (OS X).xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558EA92D1BA0FCEC00848990 /* watchOSDemo */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558EA92E1BA0FCEC00848990 /* Interface.storyboard */,
|
||||
558EA9311BA0FCEC00848990 /* Assets.xcassets */,
|
||||
558EA9331BA0FCEC00848990 /* Info.plist */,
|
||||
);
|
||||
path = watchOSDemo;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558EA93C1BA0FCEC00848990 /* watchOSDemo Extension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558EA93F1BA0FCEC00848990 /* InterfaceController.swift */,
|
||||
558EA9411BA0FCEC00848990 /* ExtensionDelegate.swift */,
|
||||
558EA9431BA0FCEC00848990 /* NotificationController.swift */,
|
||||
558EA9451BA0FCEC00848990 /* GlanceController.swift */,
|
||||
558EA9471BA0FCEC00848990 /* Assets.xcassets */,
|
||||
558EA9491BA0FCEC00848990 /* Info.plist */,
|
||||
558EA93D1BA0FCEC00848990 /* Supporting Files */,
|
||||
);
|
||||
path = "watchOSDemo Extension";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558EA93D1BA0FCEC00848990 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
558EA93E1BA0FCEC00848990 /* PushNotificationPayload.apns */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
558C648119D7770100D6D507 /* iOSDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 558C64A119D7770100D6D507 /* Build configuration list for PBXNativeTarget "iOSDemo" */;
|
||||
buildPhases = (
|
||||
558C647E19D7770100D6D507 /* Sources */,
|
||||
558C647F19D7770100D6D507 /* Frameworks */,
|
||||
558C648019D7770100D6D507 /* Resources */,
|
||||
553EEA8B19FF860900EE60AF /* Embed Frameworks */,
|
||||
558EA95A1BA0FCEC00848990 /* Embed Watch Content */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
558C64B519D777D100D6D507 /* PBXTargetDependency */,
|
||||
553EEA8A19FF860800EE60AF /* PBXTargetDependency */,
|
||||
558EA94B1BA0FCEC00848990 /* PBXTargetDependency */,
|
||||
);
|
||||
name = iOSDemo;
|
||||
productName = iOSDemo;
|
||||
productReference = 558C648219D7770100D6D507 /* iOSDemo.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
558C649619D7770100D6D507 /* iOSDemoTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 558C64A419D7770100D6D507 /* Build configuration list for PBXNativeTarget "iOSDemoTests" */;
|
||||
buildPhases = (
|
||||
558C649319D7770100D6D507 /* Sources */,
|
||||
558C649419D7770100D6D507 /* Frameworks */,
|
||||
558C649519D7770100D6D507 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
558C649919D7770100D6D507 /* PBXTargetDependency */,
|
||||
);
|
||||
name = iOSDemoTests;
|
||||
productName = iOSDemoTests;
|
||||
productReference = 558C649719D7770100D6D507 /* iOSDemoTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
558EA92B1BA0FCEC00848990 /* watchOSDemo */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 558EA9591BA0FCEC00848990 /* Build configuration list for PBXNativeTarget "watchOSDemo" */;
|
||||
buildPhases = (
|
||||
558EA92A1BA0FCEC00848990 /* Resources */,
|
||||
558EA9581BA0FCEC00848990 /* Embed App Extensions */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
558EA93B1BA0FCEC00848990 /* PBXTargetDependency */,
|
||||
);
|
||||
name = watchOSDemo;
|
||||
productName = watchOSDemo;
|
||||
productReference = 558EA92C1BA0FCEC00848990 /* watchOSDemo.app */;
|
||||
productType = "com.apple.product-type.application.watchapp2";
|
||||
};
|
||||
558EA9371BA0FCEC00848990 /* watchOSDemo Extension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 558EA9571BA0FCEC00848990 /* Build configuration list for PBXNativeTarget "watchOSDemo Extension" */;
|
||||
buildPhases = (
|
||||
558EA9341BA0FCEC00848990 /* Sources */,
|
||||
558EA9351BA0FCEC00848990 /* Frameworks */,
|
||||
558EA9361BA0FCEC00848990 /* Resources */,
|
||||
558EA9601BA0FFE500848990 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
558EA95F1BA0FFE500848990 /* PBXTargetDependency */,
|
||||
);
|
||||
name = "watchOSDemo Extension";
|
||||
productName = "watchOSDemo Extension";
|
||||
productReference = 558EA9381BA0FCEC00848990 /* watchOSDemo Extension.appex */;
|
||||
productType = "com.apple.product-type.watchkit2-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
558C647A19D7770100D6D507 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftMigration = 0700;
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0700;
|
||||
ORGANIZATIONNAME = "Cerebral Gardens";
|
||||
TargetAttributes = {
|
||||
558C648119D7770100D6D507 = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
};
|
||||
558C649619D7770100D6D507 = {
|
||||
CreatedOnToolsVersion = 6.1;
|
||||
TestTargetID = 558C648119D7770100D6D507;
|
||||
};
|
||||
558EA92B1BA0FCEC00848990 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
558EA9371BA0FCEC00848990 = {
|
||||
CreatedOnToolsVersion = 7.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 558C647D19D7770100D6D507 /* Build configuration list for PBXProject "iOSDemo" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 558C647919D7770100D6D507;
|
||||
productRefGroup = 558C648319D7770100D6D507 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 558C64A919D777B100D6D507 /* Products */;
|
||||
ProjectRef = 558C64A819D777B100D6D507 /* XCGLogger.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
558C648119D7770100D6D507 /* iOSDemo */,
|
||||
558C649619D7770100D6D507 /* iOSDemoTests */,
|
||||
558EA92B1BA0FCEC00848990 /* watchOSDemo */,
|
||||
558EA9371BA0FCEC00848990 /* watchOSDemo Extension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
558C64AF19D777B100D6D507 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 558C64AE19D777B100D6D507 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
558C64B119D777B100D6D507 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 558C64B019D777B100D6D507 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
558C64B319D777B100D6D507 /* XCGLoggerTests (iOS).xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = "XCGLoggerTests (iOS).xctest";
|
||||
remoteRef = 558C64B219D777B100D6D507 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
558EA9561BA0FCEC00848990 /* XCGLogger.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = XCGLogger.framework;
|
||||
remoteRef = 558EA9551BA0FCEC00848990 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
55D4395B1B7AAC16001370EC /* XCGLoggerTests (OS X).xctest */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.cfbundle;
|
||||
path = "XCGLoggerTests (OS X).xctest";
|
||||
remoteRef = 55D4395A1B7AAC16001370EC /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
558C648019D7770100D6D507 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558C648D19D7770100D6D507 /* Main.storyboard in Resources */,
|
||||
558C649219D7770100D6D507 /* LaunchScreen.xib in Resources */,
|
||||
558C648F19D7770100D6D507 /* Images.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558C649519D7770100D6D507 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA92A1BA0FCEC00848990 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558EA9321BA0FCEC00848990 /* Assets.xcassets in Resources */,
|
||||
558EA9301BA0FCEC00848990 /* Interface.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA9361BA0FCEC00848990 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558EA9481BA0FCEC00848990 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
558C647E19D7770100D6D507 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558C648A19D7770100D6D507 /* ViewController.swift in Sources */,
|
||||
558C648819D7770100D6D507 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558C649319D7770100D6D507 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558C649E19D7770100D6D507 /* iOSDemoTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
558EA9341BA0FCEC00848990 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
558EA9441BA0FCEC00848990 /* NotificationController.swift in Sources */,
|
||||
558EA9421BA0FCEC00848990 /* ExtensionDelegate.swift in Sources */,
|
||||
558EA9401BA0FCEC00848990 /* InterfaceController.swift in Sources */,
|
||||
558EA9461BA0FCEC00848990 /* GlanceController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
553EEA8A19FF860800EE60AF /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "XCGLogger (iOS)";
|
||||
targetProxy = 553EEA8919FF860800EE60AF /* PBXContainerItemProxy */;
|
||||
};
|
||||
558C649919D7770100D6D507 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 558C648119D7770100D6D507 /* iOSDemo */;
|
||||
targetProxy = 558C649819D7770100D6D507 /* PBXContainerItemProxy */;
|
||||
};
|
||||
558C64B519D777D100D6D507 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = XCGLogger;
|
||||
targetProxy = 558C64B419D777D100D6D507 /* PBXContainerItemProxy */;
|
||||
};
|
||||
558EA93B1BA0FCEC00848990 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 558EA9371BA0FCEC00848990 /* watchOSDemo Extension */;
|
||||
targetProxy = 558EA93A1BA0FCEC00848990 /* PBXContainerItemProxy */;
|
||||
};
|
||||
558EA94B1BA0FCEC00848990 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 558EA92B1BA0FCEC00848990 /* watchOSDemo */;
|
||||
targetProxy = 558EA94A1BA0FCEC00848990 /* PBXContainerItemProxy */;
|
||||
};
|
||||
558EA95F1BA0FFE500848990 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = "XCGLogger (watchOS)";
|
||||
targetProxy = 558EA95E1BA0FFE500848990 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
558C648B19D7770100D6D507 /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
558C648C19D7770100D6D507 /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558C649019D7770100D6D507 /* LaunchScreen.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
558C649119D7770100D6D507 /* Base */,
|
||||
);
|
||||
name = LaunchScreen.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
558EA92E1BA0FCEC00848990 /* Interface.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
558EA92F1BA0FCEC00848990 /* Base */,
|
||||
);
|
||||
name = Interface.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
558C649F19D7770100D6D507 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 3.0;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
558C64A019D7770100D6D507 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
COPY_PHASE_STRIP = YES;
|
||||
CURRENT_PROJECT_VERSION = 3.0;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
558C64A219D7770100D6D507 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = iOSDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
OTHER_SWIFT_FLAGS = "-DUSE_NSLOG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
558C64A319D7770100D6D507 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = iOSDemo/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
558C64A519D7770100D6D507 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = iOSDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.tests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSDemo.app/iOSDemo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
558C64A619D7770100D6D507 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = iOSDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.tests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/iOSDemo.app/iOSDemo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
558EA94D1BA0FCEC00848990 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
IBSC_MODULE = watchOSDemo_Extension;
|
||||
INFOPLIST_FILE = watchOSDemo/Info.plist;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.watchkitapp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
558EA94E1BA0FCEC00848990 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
IBSC_MODULE = watchOSDemo_Extension;
|
||||
INFOPLIST_FILE = watchOSDemo/Info.plist;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.watchkitapp;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
558EA94F1BA0FCEC00848990 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = "watchOSDemo Extension/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
OTHER_SWIFT_FLAGS = "-DUSE_NSLOG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.watchkitapp.watchkitextension;
|
||||
PRODUCT_NAME = "${TARGET_NAME}";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
558EA9501BA0FCEC00848990 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
INFOPLIST_FILE = "watchOSDemo Extension/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
OTHER_SWIFT_FLAGS = "-DUSE_NSLOG";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cerebralgardens.xcglogger.iosdemo.watchkitapp.watchkitextension;
|
||||
PRODUCT_NAME = "${TARGET_NAME}";
|
||||
SDKROOT = watchos;
|
||||
SKIP_INSTALL = YES;
|
||||
TARGETED_DEVICE_FAMILY = 4;
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
558C647D19D7770100D6D507 /* Build configuration list for PBXProject "iOSDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
558C649F19D7770100D6D507 /* Debug */,
|
||||
558C64A019D7770100D6D507 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
558C64A119D7770100D6D507 /* Build configuration list for PBXNativeTarget "iOSDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
558C64A219D7770100D6D507 /* Debug */,
|
||||
558C64A319D7770100D6D507 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
558C64A419D7770100D6D507 /* Build configuration list for PBXNativeTarget "iOSDemoTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
558C64A519D7770100D6D507 /* Debug */,
|
||||
558C64A619D7770100D6D507 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
558EA9571BA0FCEC00848990 /* Build configuration list for PBXNativeTarget "watchOSDemo Extension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
558EA94F1BA0FCEC00848990 /* Debug */,
|
||||
558EA9501BA0FCEC00848990 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
558EA9591BA0FCEC00848990 /* Build configuration list for PBXNativeTarget "watchOSDemo" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
558EA94D1BA0FCEC00848990 /* Debug */,
|
||||
558EA94E1BA0FCEC00848990 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 558C647A19D7770100D6D507 /* Project object */;
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:iOSDemo.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
|
@ -1,145 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA9371BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo Extension.appex"
|
||||
BlueprintName = "watchOSDemo Extension"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
launchAutomaticallySubstyle = "4"
|
||||
notificationPayloadFile = "watchOSDemo Extension/PushNotificationPayload.apns">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
launchAutomaticallySubstyle = "4"
|
||||
notificationPayloadFile = "watchOSDemo Extension/PushNotificationPayload.apns">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,145 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA9371BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo Extension.appex"
|
||||
BlueprintName = "watchOSDemo Extension"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
launchAutomaticallySubstyle = "8"
|
||||
notificationPayloadFile = "watchOSDemo Extension/PushNotificationPayload.apns">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
launchAutomaticallySubstyle = "8"
|
||||
notificationPayloadFile = "watchOSDemo Extension/PushNotificationPayload.apns">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,122 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "NO"
|
||||
buildForArchiving = "NO"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C649619D7770100D6D507"
|
||||
BuildableName = "iOSDemoTests.xctest"
|
||||
BlueprintName = "iOSDemoTests"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C649619D7770100D6D507"
|
||||
BuildableName = "iOSDemoTests.xctest"
|
||||
BlueprintName = "iOSDemoTests"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "XcodeColors"
|
||||
value = "YES"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,141 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0700"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558C648119D7770100D6D507"
|
||||
BuildableName = "iOSDemo.app"
|
||||
BlueprintName = "iOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA9371BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo Extension.appex"
|
||||
BlueprintName = "watchOSDemo Extension"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.carousel"
|
||||
RemotePath = "/iOSDemo">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "558EA92B1BA0FCEC00848990"
|
||||
BuildableName = "watchOSDemo.app"
|
||||
BlueprintName = "watchOSDemo"
|
||||
ReferencedContainer = "container:iOSDemo.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -1,86 +0,0 @@
|
|||
//
|
||||
// AppDelegate.swift
|
||||
// XCGLogger: https://github.com/DaveWoodCom/XCGLogger
|
||||
//
|
||||
// Created by Dave Wood on 2014-06-06.
|
||||
// Copyright (c) 2014 Dave Wood, Cerebral Gardens.
|
||||
// Some rights reserved: https://github.com/DaveWoodCom/XCGLogger/blob/master/LICENSE.txt
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import XCGLogger
|
||||
|
||||
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
|
||||
let log: XCGLogger = {
|
||||
// Setup XCGLogger
|
||||
let log = XCGLogger.defaultInstance()
|
||||
log.xcodeColorsEnabled = true // Or set the XcodeColors environment variable in your scheme to YES
|
||||
log.xcodeColors = [
|
||||
.Verbose: .lightGrey,
|
||||
.Debug: .darkGrey,
|
||||
.Info: .darkGreen,
|
||||
.Warning: .orange,
|
||||
.Error: XCGLogger.XcodeColor(fg: UIColor.redColor(), bg: UIColor.whiteColor()), // Optionally use a UIColor
|
||||
.Severe: XCGLogger.XcodeColor(fg: (255, 255, 255), bg: (255, 0, 0)) // Optionally use RGB values directly
|
||||
]
|
||||
|
||||
#if USE_NSLOG // Set via Build Settings, under Other Swift Flags
|
||||
log.removeLogDestination(XCGLogger.constants.baseConsoleLogDestinationIdentifier)
|
||||
log.addLogDestination(XCGNSLogDestination(owner: log, identifier: XCGLogger.constants.nslogDestinationIdentifier))
|
||||
log.logAppDetails()
|
||||
#else
|
||||
let logPath: NSURL = appDelegate.cacheDirectory.URLByAppendingPathComponent("XCGLogger_Log.txt")
|
||||
log.setup(.Debug, showThreadName: true, showLogLevel: true, showFileNames: true, showLineNumbers: true, writeToFile: logPath)
|
||||
#endif
|
||||
|
||||
return log
|
||||
}()
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
var window: UIWindow?
|
||||
|
||||
let documentsDirectory: NSURL = {
|
||||
let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)
|
||||
return urls[urls.endIndex - 1]
|
||||
}()
|
||||
|
||||
let cacheDirectory: NSURL = {
|
||||
let urls = NSFileManager.defaultManager().URLsForDirectory(.CachesDirectory, inDomains: .UserDomainMask)
|
||||
return urls[urls.endIndex - 1]
|
||||
}()
|
||||
|
||||
// MARK: - Life cycle methods
|
||||
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(application: UIApplication) {
|
||||
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
}
|
||||
|
||||
func noop() {
|
||||
// Global no operation function, useful for doing nothing in a switch option, and examples
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6214" systemVersion="14A314h" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6207"/>
|
||||
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2014 Cerebral Gardens. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
|
||||
<rect key="frame" x="20" y="439" width="441" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="iOSDemo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
|
||||
<rect key="frame" x="20" y="140" width="441" height="43"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
|
||||
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
|
||||
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
|
||||
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
|
||||
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
|
||||
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="548" y="455"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
|
@ -1,227 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="iOSDemo" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Current Log Level" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dIL-ul-q6u">
|
||||
<rect key="frame" x="20" y="20" width="137" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="140-xy-loj"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="6" translatesAutoresizingMaskIntoConstraints="NO" id="SjH-ki-WTR">
|
||||
<rect key="frame" x="18" y="49" width="564" height="31"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="kXF-qP-TLJ"/>
|
||||
</constraints>
|
||||
<connections>
|
||||
<action selector="logLevelSliderValueChanged:" destination="BYZ-38-t0r" eventType="valueChanged" id="Q5R-fU-W8I"/>
|
||||
</connections>
|
||||
</slider>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Generate Test Log" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1zy-OP-hRV">
|
||||
<rect key="frame" x="20" y="87" width="560" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="RCa-Lc-Vzf"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Whp-6F-VJf">
|
||||
<rect key="frame" x="20" y="116" width="560" height="51"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="chq-fA-bP9"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Verbose">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="chq-fA-bP9"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="verboseButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="x8A-Nm-bet"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8IW-wu-eS0">
|
||||
<rect key="frame" x="20" y="175" width="560" height="52"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="PHl-IC-bzm"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Debug">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="PHl-IC-bzm"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="debugButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="J6B-w6-zf0"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7Th-pb-mc6">
|
||||
<rect key="frame" x="20" y="235" width="560" height="51"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="s1v-E6-IPb"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Info">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="s1v-E6-IPb"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="infoButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="2BI-a0-XQi"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qlo-FC-GNh">
|
||||
<rect key="frame" x="20" y="353" width="560" height="52"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="nFj-cw-PYe"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Error">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="nFj-cw-PYe"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="errorButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="j9O-hN-W0d"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="csa-Jy-lFF">
|
||||
<rect key="frame" x="20" y="413" width="560" height="51"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="nR0-hM-NNM"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Severe">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="nR0-hM-NNM"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="severeButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="D0f-Nb-teQ"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UEf-4I-iHz">
|
||||
<rect key="frame" x="20" y="294" width="560" height="51"/>
|
||||
<color key="backgroundColor" red="0.86274509799999999" green="0.86666666670000003" blue="0.87450980389999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="Osl-ob-RXy"/>
|
||||
</constraints>
|
||||
<state key="normal" title="Warning">
|
||||
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</state>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="Osl-ob-RXy"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<connections>
|
||||
<action selector="warningButtonTouchUpInside:" destination="BYZ-38-t0r" eventType="touchUpInside" id="hv5-Lk-8dh"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="249" verticalHuggingPriority="251" text="Debug" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MdE-sg-fKw">
|
||||
<rect key="frame" x="165" y="20" width="415" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="Uo3-kY-yMD"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<textView clipsSubviews="YES" multipleTouchEnabled="YES" userInteractionEnabled="NO" contentMode="scaleToFill" editable="NO" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qJe-QA-vau">
|
||||
<rect key="frame" x="20" y="472" width="560" height="120"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="120" id="qzM-1D-7WA"/>
|
||||
</constraints>
|
||||
<string key="text">XCGLogger will only log messages that are set for the same or higher log level. So when the current log level is set to Info for example, neither Verbose nor Debug logs will be displayed, but Info, Warning, Error and Severe logs will be displayed.</string>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
|
||||
</textView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="7Th-pb-mc6" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="0HM-ZD-l3P"/>
|
||||
<constraint firstItem="Qlo-FC-GNh" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="0t7-cn-Rf2"/>
|
||||
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="qJe-QA-vau" secondAttribute="bottom" constant="8" symbolic="YES" id="2J4-5Y-V90"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qJe-QA-vau" secondAttribute="trailing" constant="20" symbolic="YES" id="5mt-sQ-u7F"/>
|
||||
<constraint firstItem="SjH-ki-WTR" firstAttribute="top" secondItem="dIL-ul-q6u" secondAttribute="bottom" constant="8" symbolic="YES" id="6b5-dG-xq8"/>
|
||||
<constraint firstItem="1zy-OP-hRV" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="7bZ-JW-TZx"/>
|
||||
<constraint firstItem="UEf-4I-iHz" firstAttribute="height" secondItem="7Th-pb-mc6" secondAttribute="height" id="7zG-gS-3oW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Qlo-FC-GNh" secondAttribute="trailing" constant="20" symbolic="YES" id="HqA-ww-RNJ"/>
|
||||
<constraint firstItem="qJe-QA-vau" firstAttribute="top" secondItem="csa-Jy-lFF" secondAttribute="bottom" constant="8" symbolic="YES" id="HuD-LF-tv6"/>
|
||||
<constraint firstItem="8IW-wu-eS0" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="K4W-Th-sAB"/>
|
||||
<constraint firstItem="7Th-pb-mc6" firstAttribute="top" secondItem="8IW-wu-eS0" secondAttribute="bottom" constant="8" symbolic="YES" id="M6j-c6-6Ae"/>
|
||||
<constraint firstItem="MdE-sg-fKw" firstAttribute="leading" secondItem="dIL-ul-q6u" secondAttribute="trailing" constant="8" symbolic="YES" id="P3Q-bN-53m"/>
|
||||
<constraint firstItem="7Th-pb-mc6" firstAttribute="height" secondItem="8IW-wu-eS0" secondAttribute="height" id="PcK-3N-xMs"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SjH-ki-WTR" secondAttribute="trailing" constant="20" symbolic="YES" id="RbT-B8-3ak"/>
|
||||
<constraint firstAttribute="trailing" secondItem="UEf-4I-iHz" secondAttribute="trailing" constant="20" symbolic="YES" id="Sia-Gj-AbA"/>
|
||||
<constraint firstItem="UEf-4I-iHz" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="TfB-a9-kNq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Whp-6F-VJf" secondAttribute="trailing" constant="20" symbolic="YES" id="Xc8-hU-x4E"/>
|
||||
<constraint firstItem="csa-Jy-lFF" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="aKg-f5-vdb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1zy-OP-hRV" secondAttribute="trailing" constant="20" symbolic="YES" id="as1-cv-lX7"/>
|
||||
<constraint firstItem="Qlo-FC-GNh" firstAttribute="top" secondItem="UEf-4I-iHz" secondAttribute="bottom" constant="8" symbolic="YES" id="b7W-0j-EE7"/>
|
||||
<constraint firstItem="UEf-4I-iHz" firstAttribute="height" secondItem="Qlo-FC-GNh" secondAttribute="height" id="bAb-Zu-eMe"/>
|
||||
<constraint firstItem="Whp-6F-VJf" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="f4R-sy-fUx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="csa-Jy-lFF" secondAttribute="trailing" constant="20" symbolic="YES" id="g2c-Sx-p8f"/>
|
||||
<constraint firstItem="Whp-6F-VJf" firstAttribute="top" secondItem="1zy-OP-hRV" secondAttribute="bottom" constant="8" symbolic="YES" id="grq-Yg-Bye"/>
|
||||
<constraint firstAttribute="trailing" secondItem="MdE-sg-fKw" secondAttribute="trailing" constant="20" symbolic="YES" id="jw7-mN-DR5"/>
|
||||
<constraint firstItem="1zy-OP-hRV" firstAttribute="top" secondItem="SjH-ki-WTR" secondAttribute="bottom" constant="8" symbolic="YES" id="m9S-0r-AhK"/>
|
||||
<constraint firstItem="dIL-ul-q6u" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="mIk-QJ-GHV"/>
|
||||
<constraint firstItem="qJe-QA-vau" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="mnH-60-0g6"/>
|
||||
<constraint firstItem="csa-Jy-lFF" firstAttribute="height" secondItem="Qlo-FC-GNh" secondAttribute="height" id="ncx-i3-DjJ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7Th-pb-mc6" secondAttribute="trailing" constant="20" symbolic="YES" id="rUN-Fd-udd"/>
|
||||
<constraint firstItem="8IW-wu-eS0" firstAttribute="top" secondItem="Whp-6F-VJf" secondAttribute="bottom" constant="8" symbolic="YES" id="tvJ-TX-QT5"/>
|
||||
<constraint firstItem="MdE-sg-fKw" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="20" symbolic="YES" id="u2D-fW-wBS"/>
|
||||
<constraint firstItem="UEf-4I-iHz" firstAttribute="top" secondItem="7Th-pb-mc6" secondAttribute="bottom" constant="8" symbolic="YES" id="usC-hm-v59"/>
|
||||
<constraint firstItem="dIL-ul-q6u" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" constant="20" symbolic="YES" id="wV0-Mo-fZX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8IW-wu-eS0" secondAttribute="trailing" constant="20" symbolic="YES" id="xE5-dt-x9o"/>
|
||||
<constraint firstItem="Whp-6F-VJf" firstAttribute="height" secondItem="8IW-wu-eS0" secondAttribute="height" id="zYm-du-BHo"/>
|
||||
<constraint firstItem="SjH-ki-WTR" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" constant="20" symbolic="YES" id="ziX-KE-RTc"/>
|
||||
<constraint firstItem="csa-Jy-lFF" firstAttribute="top" secondItem="Qlo-FC-GNh" secondAttribute="bottom" constant="8" symbolic="YES" id="zjd-Xg-5mb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="currentLogLevelLabel" destination="MdE-sg-fKw" id="EOp-6d-Iby"/>
|
||||
<outlet property="generateLabel" destination="1zy-OP-hRV" id="qNf-Vt-hCU"/>
|
||||
<outlet property="logLevelLabel" destination="dIL-ul-q6u" id="727-IS-OfK"/>
|
||||
<outlet property="logLevelSlider" destination="SjH-ki-WTR" id="bRx-Nw-8mu"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue