Parcourir la source

Initial Commit

Norio Nomura il y a 10 ans
commit
2163ee2f29
39 fichiers modifiés avec 2315 ajouts et 0 suppressions
  1. 25 0
      .gitignore
  2. 15 0
      .travis.yml
  3. 722 0
      Base32.xcodeproj/project.pbxproj
  4. 7 0
      Base32.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  5. 115 0
      Base32.xcodeproj/xcshareddata/xcschemes/Base32-Mac.xcscheme
  6. 110 0
      Base32.xcodeproj/xcshareddata/xcschemes/Base32-iOS.xcscheme
  7. 19 0
      Base32/Base32.h
  8. 394 0
      Base32/Base32.swift
  9. 28 0
      Base32/Info.plist
  10. 146 0
      Base32Tests/Base32Tests.swift
  11. 24 0
      Base32Tests/Info.plist
  12. 1 0
      Cartfile
  13. 1 0
      Cartfile.resolved
  14. 174 0
      Carthage/Checkouts/xcconfigs/Base/Common.xcconfig
  15. 43 0
      Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig
  16. 27 0
      Carthage/Checkouts/xcconfigs/Base/Configurations/Profile.xcconfig
  17. 33 0
      Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig
  18. 10 0
      Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig
  19. 12 0
      Carthage/Checkouts/xcconfigs/Base/Targets/Application.xcconfig
  20. 26 0
      Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig
  21. 26 0
      Carthage/Checkouts/xcconfigs/Base/Targets/StaticLibrary.xcconfig
  22. 1 0
      Carthage/Checkouts/xcconfigs/Carthage/Build
  23. 15 0
      Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig
  24. 19 0
      Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig
  25. 18 0
      Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig
  26. 11 0
      Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig
  27. 11 0
      Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig
  28. 13 0
      Carthage/Checkouts/xcconfigs/README.md
  29. 11 0
      Carthage/Checkouts/xcconfigs/iOS/iOS-Application.xcconfig
  30. 15 0
      Carthage/Checkouts/xcconfigs/iOS/iOS-Base.xcconfig
  31. 11 0
      Carthage/Checkouts/xcconfigs/iOS/iOS-Framework.xcconfig
  32. 14 0
      Carthage/Checkouts/xcconfigs/iOS/iOS-StaticLibrary.xcconfig
  33. 6 0
      Gemfile
  34. 20 0
      Gemfile.lock
  35. 21 0
      LICENSE
  36. 26 0
      README.md
  37. 44 0
      Rakefile
  38. 24 0
      SecEncodeTransformTests/Info.plist
  39. 77 0
      SecEncodeTransformTests/SecEncodeTransformTests.swift

+ 25 - 0
.gitignore

@@ -0,0 +1,25 @@
+# Xcode
+#
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
+
+Carthage.pkg
+Carthage/Build
+
+# Bundler
+.bundle
+vendor/

+ 15 - 0
.travis.yml

@@ -0,0 +1,15 @@
+language: objective-c
+cache:
+  directories:
+    - vendor/bundle
+install:
+  - bundle install --path=vendor/bundle --binstubs=vendor/bin
+script:
+  - bundle exec rake test:ios test:osx test:SecEncodeTransformTests
+branches:
+  only:
+    - master
+env:
+  global:
+    - LANG=en_US.UTF-8
+    - LC_ALL=en_US.UTF-8

+ 722 - 0
Base32.xcodeproj/project.pbxproj

@@ -0,0 +1,722 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		6CA0A79E1A74E80600AC539F /* Base32.h in Headers */ = {isa = PBXBuildFile; fileRef = 6CA0A79D1A74E80600AC539F /* Base32.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		6CA0A7A41A74E80600AC539F /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA0A7981A74E80600AC539F /* Base32.framework */; };
+		6CA0A7AB1A74E80600AC539F /* Base32Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA0A7AA1A74E80600AC539F /* Base32Tests.swift */; };
+		6CA0A7DE1A74E91800AC539F /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA0A7D31A74E91700AC539F /* Base32.framework */; };
+		6CA0A7EE1A74ECD700AC539F /* Base32Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA0A7AA1A74E80600AC539F /* Base32Tests.swift */; };
+		6CA0A7F01A74ECEE00AC539F /* Base32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA0A7EF1A74ECEE00AC539F /* Base32.swift */; };
+		6CA0A7F11A74ECEE00AC539F /* Base32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA0A7EF1A74ECEE00AC539F /* Base32.swift */; };
+		6CA0A80C1A75135D00AC539F /* SecEncodeTransformTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CA0A80B1A75135D00AC539F /* SecEncodeTransformTests.swift */; };
+		6CA0A80D1A75135D00AC539F /* Base32.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA0A7981A74E80600AC539F /* Base32.framework */; };
+		6CA0A8131A75138900AC539F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6CA0A7F71A7507CE00AC539F /* Security.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		6CA0A7A51A74E80600AC539F /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 6CA0A78F1A74E80600AC539F /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 6CA0A7971A74E80600AC539F;
+			remoteInfo = Base32;
+		};
+		6CA0A7DF1A74E91800AC539F /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 6CA0A78F1A74E80600AC539F /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 6CA0A7D21A74E91700AC539F;
+			remoteInfo = Base32;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		6CA0A7981A74E80600AC539F /* Base32.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Base32.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		6CA0A79C1A74E80600AC539F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		6CA0A79D1A74E80600AC539F /* Base32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Base32.h; sourceTree = "<group>"; };
+		6CA0A7A31A74E80600AC539F /* Base32-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Base32-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+		6CA0A7A91A74E80600AC539F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		6CA0A7AA1A74E80600AC539F /* Base32Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base32Tests.swift; sourceTree = "<group>"; };
+		6CA0A7B61A74E88E00AC539F /* Common.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Common.xcconfig; sourceTree = "<group>"; };
+		6CA0A7B81A74E88E00AC539F /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
+		6CA0A7B91A74E88E00AC539F /* Profile.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Profile.xcconfig; sourceTree = "<group>"; };
+		6CA0A7BA1A74E88E00AC539F /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
+		6CA0A7BB1A74E88E00AC539F /* Test.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Test.xcconfig; sourceTree = "<group>"; };
+		6CA0A7BD1A74E88E00AC539F /* Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Application.xcconfig; sourceTree = "<group>"; };
+		6CA0A7BE1A74E88E00AC539F /* Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Framework.xcconfig; sourceTree = "<group>"; };
+		6CA0A7BF1A74E88E00AC539F /* StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = StaticLibrary.xcconfig; sourceTree = "<group>"; };
+		6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Application.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7C41A74E88E00AC539F /* iOS-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Base.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-Framework.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7C61A74E88E00AC539F /* iOS-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "iOS-StaticLibrary.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Application.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7C91A74E88E00AC539F /* Mac-Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Base.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7CA1A74E88E00AC539F /* Mac-DynamicLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-DynamicLibrary.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-Framework.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7CC1A74E88E00AC539F /* Mac-StaticLibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Mac-StaticLibrary.xcconfig"; sourceTree = "<group>"; };
+		6CA0A7CD1A74E88E00AC539F /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
+		6CA0A7D31A74E91700AC539F /* Base32.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Base32.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		6CA0A7DD1A74E91800AC539F /* Base32-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Base32-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
+		6CA0A7EC1A74ECA900AC539F /* Cartfile */ = {isa = PBXFileReference; lastKnownFileType = text; path = Cartfile; sourceTree = "<group>"; };
+		6CA0A7ED1A74ECC500AC539F /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
+		6CA0A7EF1A74ECEE00AC539F /* Base32.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Base32.swift; sourceTree = "<group>"; };
+		6CA0A7F31A74EE7B00AC539F /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
+		6CA0A7F71A7507CE00AC539F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+		6CA0A8071A75135D00AC539F /* SecEncodeTransformTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SecEncodeTransformTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		6CA0A80A1A75135D00AC539F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		6CA0A80B1A75135D00AC539F /* SecEncodeTransformTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecEncodeTransformTests.swift; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		6CA0A7941A74E80600AC539F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7A01A74E80600AC539F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7A41A74E80600AC539F /* Base32.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7CF1A74E91700AC539F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7DA1A74E91800AC539F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7DE1A74E91800AC539F /* Base32.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A8041A75135D00AC539F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A8131A75138900AC539F /* Security.framework in Frameworks */,
+				6CA0A80D1A75135D00AC539F /* Base32.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		6CA0A78E1A74E80600AC539F = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7ED1A74ECC500AC539F /* README.md */,
+				6CA0A7F31A74EE7B00AC539F /* LICENSE */,
+				6CA0A7EC1A74ECA900AC539F /* Cartfile */,
+				6CA0A79A1A74E80600AC539F /* Base32 */,
+				6CA0A7A71A74E80600AC539F /* Base32Tests */,
+				6CA0A7B41A74E88E00AC539F /* xcconfigs */,
+				6CA0A8081A75135D00AC539F /* SecEncodeTransformTests */,
+				6CA0A7991A74E80600AC539F /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		6CA0A7991A74E80600AC539F /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7981A74E80600AC539F /* Base32.framework */,
+				6CA0A7A31A74E80600AC539F /* Base32-MacTests.xctest */,
+				6CA0A7D31A74E91700AC539F /* Base32.framework */,
+				6CA0A7DD1A74E91800AC539F /* Base32-iOSTests.xctest */,
+				6CA0A8071A75135D00AC539F /* SecEncodeTransformTests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		6CA0A79A1A74E80600AC539F /* Base32 */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A79D1A74E80600AC539F /* Base32.h */,
+				6CA0A7EF1A74ECEE00AC539F /* Base32.swift */,
+				6CA0A79B1A74E80600AC539F /* Supporting Files */,
+			);
+			path = Base32;
+			sourceTree = "<group>";
+		};
+		6CA0A79B1A74E80600AC539F /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A79C1A74E80600AC539F /* Info.plist */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+		6CA0A7A71A74E80600AC539F /* Base32Tests */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7AA1A74E80600AC539F /* Base32Tests.swift */,
+				6CA0A7A81A74E80600AC539F /* Supporting Files */,
+			);
+			path = Base32Tests;
+			sourceTree = "<group>";
+		};
+		6CA0A7A81A74E80600AC539F /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7A91A74E80600AC539F /* Info.plist */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+		6CA0A7B41A74E88E00AC539F /* xcconfigs */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7B51A74E88E00AC539F /* Base */,
+				6CA0A7C01A74E88E00AC539F /* Carthage */,
+				6CA0A7C21A74E88E00AC539F /* iOS */,
+				6CA0A7C71A74E88E00AC539F /* Mac OS X */,
+				6CA0A7CD1A74E88E00AC539F /* README.md */,
+			);
+			name = xcconfigs;
+			path = Carthage/Checkouts/xcconfigs;
+			sourceTree = "<group>";
+		};
+		6CA0A7B51A74E88E00AC539F /* Base */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7B61A74E88E00AC539F /* Common.xcconfig */,
+				6CA0A7B71A74E88E00AC539F /* Configurations */,
+				6CA0A7BC1A74E88E00AC539F /* Targets */,
+			);
+			path = Base;
+			sourceTree = "<group>";
+		};
+		6CA0A7B71A74E88E00AC539F /* Configurations */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7B81A74E88E00AC539F /* Debug.xcconfig */,
+				6CA0A7B91A74E88E00AC539F /* Profile.xcconfig */,
+				6CA0A7BA1A74E88E00AC539F /* Release.xcconfig */,
+				6CA0A7BB1A74E88E00AC539F /* Test.xcconfig */,
+			);
+			path = Configurations;
+			sourceTree = "<group>";
+		};
+		6CA0A7BC1A74E88E00AC539F /* Targets */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7BD1A74E88E00AC539F /* Application.xcconfig */,
+				6CA0A7BE1A74E88E00AC539F /* Framework.xcconfig */,
+				6CA0A7BF1A74E88E00AC539F /* StaticLibrary.xcconfig */,
+			);
+			path = Targets;
+			sourceTree = "<group>";
+		};
+		6CA0A7C01A74E88E00AC539F /* Carthage */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7C11A74E88E00AC539F /* Build */,
+			);
+			path = Carthage;
+			sourceTree = "<group>";
+		};
+		6CA0A7C11A74E88E00AC539F /* Build */ = {
+			isa = PBXGroup;
+			children = (
+			);
+			path = Build;
+			sourceTree = "<group>";
+		};
+		6CA0A7C21A74E88E00AC539F /* iOS */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */,
+				6CA0A7C41A74E88E00AC539F /* iOS-Base.xcconfig */,
+				6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */,
+				6CA0A7C61A74E88E00AC539F /* iOS-StaticLibrary.xcconfig */,
+			);
+			path = iOS;
+			sourceTree = "<group>";
+		};
+		6CA0A7C71A74E88E00AC539F /* Mac OS X */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */,
+				6CA0A7C91A74E88E00AC539F /* Mac-Base.xcconfig */,
+				6CA0A7CA1A74E88E00AC539F /* Mac-DynamicLibrary.xcconfig */,
+				6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */,
+				6CA0A7CC1A74E88E00AC539F /* Mac-StaticLibrary.xcconfig */,
+			);
+			path = "Mac OS X";
+			sourceTree = "<group>";
+		};
+		6CA0A8001A750A7F00AC539F /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A7F71A7507CE00AC539F /* Security.framework */,
+			);
+			name = Frameworks;
+			path = ..;
+			sourceTree = "<group>";
+		};
+		6CA0A8081A75135D00AC539F /* SecEncodeTransformTests */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A80B1A75135D00AC539F /* SecEncodeTransformTests.swift */,
+				6CA0A8091A75135D00AC539F /* Supporting Files */,
+				6CA0A8001A750A7F00AC539F /* Frameworks */,
+			);
+			path = SecEncodeTransformTests;
+			sourceTree = "<group>";
+		};
+		6CA0A8091A75135D00AC539F /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				6CA0A80A1A75135D00AC539F /* Info.plist */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		6CA0A7951A74E80600AC539F /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A79E1A74E80600AC539F /* Base32.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7D01A74E91700AC539F /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		6CA0A7971A74E80600AC539F /* Base32-Mac */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CA0A7AE1A74E80600AC539F /* Build configuration list for PBXNativeTarget "Base32-Mac" */;
+			buildPhases = (
+				6CA0A7931A74E80600AC539F /* Sources */,
+				6CA0A7941A74E80600AC539F /* Frameworks */,
+				6CA0A7951A74E80600AC539F /* Headers */,
+				6CA0A7961A74E80600AC539F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Base32-Mac";
+			productName = Base32;
+			productReference = 6CA0A7981A74E80600AC539F /* Base32.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		6CA0A7A21A74E80600AC539F /* Base32-MacTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CA0A7B11A74E80600AC539F /* Build configuration list for PBXNativeTarget "Base32-MacTests" */;
+			buildPhases = (
+				6CA0A79F1A74E80600AC539F /* Sources */,
+				6CA0A7A01A74E80600AC539F /* Frameworks */,
+				6CA0A7A11A74E80600AC539F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				6CA0A7A61A74E80600AC539F /* PBXTargetDependency */,
+			);
+			name = "Base32-MacTests";
+			productName = Base32Tests;
+			productReference = 6CA0A7A31A74E80600AC539F /* Base32-MacTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+		6CA0A7D21A74E91700AC539F /* Base32-iOS */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CA0A7E61A74E91800AC539F /* Build configuration list for PBXNativeTarget "Base32-iOS" */;
+			buildPhases = (
+				6CA0A7CE1A74E91700AC539F /* Sources */,
+				6CA0A7CF1A74E91700AC539F /* Frameworks */,
+				6CA0A7D01A74E91700AC539F /* Headers */,
+				6CA0A7D11A74E91700AC539F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = "Base32-iOS";
+			productName = Base32;
+			productReference = 6CA0A7D31A74E91700AC539F /* Base32.framework */;
+			productType = "com.apple.product-type.framework";
+		};
+		6CA0A7DC1A74E91800AC539F /* Base32-iOSTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CA0A7E91A74E91800AC539F /* Build configuration list for PBXNativeTarget "Base32-iOSTests" */;
+			buildPhases = (
+				6CA0A7D91A74E91800AC539F /* Sources */,
+				6CA0A7DA1A74E91800AC539F /* Frameworks */,
+				6CA0A7DB1A74E91800AC539F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				6CA0A7E01A74E91800AC539F /* PBXTargetDependency */,
+			);
+			name = "Base32-iOSTests";
+			productName = Base32Tests;
+			productReference = 6CA0A7DD1A74E91800AC539F /* Base32-iOSTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+		6CA0A8061A75135D00AC539F /* SecEncodeTransformTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 6CA0A8101A75135D00AC539F /* Build configuration list for PBXNativeTarget "SecEncodeTransformTests" */;
+			buildPhases = (
+				6CA0A8031A75135D00AC539F /* Sources */,
+				6CA0A8041A75135D00AC539F /* Frameworks */,
+				6CA0A8051A75135D00AC539F /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = SecEncodeTransformTests;
+			productName = SecEncodeTransformTests;
+			productReference = 6CA0A8071A75135D00AC539F /* SecEncodeTransformTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		6CA0A78F1A74E80600AC539F /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0610;
+				ORGANIZATIONNAME = "Norio Nomura";
+				TargetAttributes = {
+					6CA0A7971A74E80600AC539F = {
+						CreatedOnToolsVersion = 6.1.1;
+					};
+					6CA0A7A21A74E80600AC539F = {
+						CreatedOnToolsVersion = 6.1.1;
+					};
+					6CA0A7D21A74E91700AC539F = {
+						CreatedOnToolsVersion = 6.1.1;
+					};
+					6CA0A7DC1A74E91800AC539F = {
+						CreatedOnToolsVersion = 6.1.1;
+					};
+					6CA0A8061A75135D00AC539F = {
+						CreatedOnToolsVersion = 6.1.1;
+					};
+				};
+			};
+			buildConfigurationList = 6CA0A7921A74E80600AC539F /* Build configuration list for PBXProject "Base32" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 6CA0A78E1A74E80600AC539F;
+			productRefGroup = 6CA0A7991A74E80600AC539F /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				6CA0A7971A74E80600AC539F /* Base32-Mac */,
+				6CA0A7A21A74E80600AC539F /* Base32-MacTests */,
+				6CA0A7D21A74E91700AC539F /* Base32-iOS */,
+				6CA0A7DC1A74E91800AC539F /* Base32-iOSTests */,
+				6CA0A8061A75135D00AC539F /* SecEncodeTransformTests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+		6CA0A7961A74E80600AC539F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7A11A74E80600AC539F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7D11A74E91700AC539F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7DB1A74E91800AC539F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A8051A75135D00AC539F /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		6CA0A7931A74E80600AC539F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7F01A74ECEE00AC539F /* Base32.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A79F1A74E80600AC539F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7AB1A74E80600AC539F /* Base32Tests.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7CE1A74E91700AC539F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7F11A74ECEE00AC539F /* Base32.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A7D91A74E91800AC539F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A7EE1A74ECD700AC539F /* Base32Tests.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		6CA0A8031A75135D00AC539F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				6CA0A80C1A75135D00AC539F /* SecEncodeTransformTests.swift in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		6CA0A7A61A74E80600AC539F /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 6CA0A7971A74E80600AC539F /* Base32-Mac */;
+			targetProxy = 6CA0A7A51A74E80600AC539F /* PBXContainerItemProxy */;
+		};
+		6CA0A7E01A74E91800AC539F /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 6CA0A7D21A74E91700AC539F /* Base32-iOS */;
+			targetProxy = 6CA0A7DF1A74E91800AC539F /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		6CA0A7AC1A74E80600AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7B81A74E88E00AC539F /* Debug.xcconfig */;
+			buildSettings = {
+				CURRENT_PROJECT_VERSION = 1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				VERSIONING_SYSTEM = "apple-generic";
+				VERSION_INFO_PREFIX = "";
+			};
+			name = Debug;
+		};
+		6CA0A7AD1A74E80600AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7BA1A74E88E00AC539F /* Release.xcconfig */;
+			buildSettings = {
+				CURRENT_PROJECT_VERSION = 1;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MACOSX_DEPLOYMENT_TARGET = 10.10;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				VERSIONING_SYSTEM = "apple-generic";
+				VERSION_INFO_PREFIX = "";
+			};
+			name = Release;
+		};
+		6CA0A7AF1A74E80600AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
+			buildSettings = {
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				INFOPLIST_FILE = Base32/Info.plist;
+			};
+			name = Debug;
+		};
+		6CA0A7B01A74E80600AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7CB1A74E88E00AC539F /* Mac-Framework.xcconfig */;
+			buildSettings = {
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				INFOPLIST_FILE = Base32/Info.plist;
+			};
+			name = Release;
+		};
+		6CA0A7B21A74E80600AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		6CA0A7B31A74E80600AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+		6CA0A7E71A74E91800AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
+			buildSettings = {
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				INFOPLIST_FILE = Base32/Info.plist;
+			};
+			name = Debug;
+		};
+		6CA0A7E81A74E91800AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C51A74E88E00AC539F /* iOS-Framework.xcconfig */;
+			buildSettings = {
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+				DYLIB_COMPATIBILITY_VERSION = 1;
+				DYLIB_CURRENT_VERSION = 1;
+				INFOPLIST_FILE = Base32/Info.plist;
+			};
+			name = Release;
+		};
+		6CA0A7EA1A74E91800AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		6CA0A7EB1A74E91800AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C31A74E88E00AC539F /* iOS-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = Base32Tests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+		6CA0A8111A75135D00AC539F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		6CA0A8121A75135D00AC539F /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = 6CA0A7C81A74E88E00AC539F /* Mac-Application.xcconfig */;
+			buildSettings = {
+				INFOPLIST_FILE = SecEncodeTransformTests/Info.plist;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		6CA0A7921A74E80600AC539F /* Build configuration list for PBXProject "Base32" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A7AC1A74E80600AC539F /* Debug */,
+				6CA0A7AD1A74E80600AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		6CA0A7AE1A74E80600AC539F /* Build configuration list for PBXNativeTarget "Base32-Mac" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A7AF1A74E80600AC539F /* Debug */,
+				6CA0A7B01A74E80600AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		6CA0A7B11A74E80600AC539F /* Build configuration list for PBXNativeTarget "Base32-MacTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A7B21A74E80600AC539F /* Debug */,
+				6CA0A7B31A74E80600AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		6CA0A7E61A74E91800AC539F /* Build configuration list for PBXNativeTarget "Base32-iOS" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A7E71A74E91800AC539F /* Debug */,
+				6CA0A7E81A74E91800AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		6CA0A7E91A74E91800AC539F /* Build configuration list for PBXNativeTarget "Base32-iOSTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A7EA1A74E91800AC539F /* Debug */,
+				6CA0A7EB1A74E91800AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		6CA0A8101A75135D00AC539F /* Build configuration list for PBXNativeTarget "SecEncodeTransformTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				6CA0A8111A75135D00AC539F /* Debug */,
+				6CA0A8121A75135D00AC539F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 6CA0A78F1A74E80600AC539F /* Project object */;
+}

+ 7 - 0
Base32.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:Base32.xcodeproj">
+   </FileRef>
+</Workspace>

+ 115 - 0
Base32.xcodeproj/xcshareddata/xcschemes/Base32-Mac.xcscheme

@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0610"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7971A74E80600AC539F"
+               BuildableName = "Base32.framework"
+               BlueprintName = "Base32-Mac"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "NO"
+            buildForArchiving = "NO"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7A21A74E80600AC539F"
+               BuildableName = "Base32-MacTests.xctest"
+               BlueprintName = "Base32-MacTests"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Release">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7A21A74E80600AC539F"
+               BuildableName = "Base32-MacTests.xctest"
+               BlueprintName = "Base32-MacTests"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+            <SkippedTests>
+               <Test
+                  Identifier = "SecEncodeTransformTests">
+               </Test>
+            </SkippedTests>
+         </TestableReference>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7971A74E80600AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-Mac"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7971A74E80600AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-Mac"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7971A74E80600AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-Mac"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 110 - 0
Base32.xcodeproj/xcshareddata/xcschemes/Base32-iOS.xcscheme

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0610"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7D21A74E91700AC539F"
+               BuildableName = "Base32.framework"
+               BlueprintName = "Base32-iOS"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "NO"
+            buildForArchiving = "NO"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7DC1A74E91800AC539F"
+               BuildableName = "Base32-iOSTests.xctest"
+               BlueprintName = "Base32-iOSTests"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Release">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "6CA0A7DC1A74E91800AC539F"
+               BuildableName = "Base32-iOSTests.xctest"
+               BlueprintName = "Base32-iOSTests"
+               ReferencedContainer = "container:Base32.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7D21A74E91700AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-iOS"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7D21A74E91700AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-iOS"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "6CA0A7D21A74E91700AC539F"
+            BuildableName = "Base32.framework"
+            BlueprintName = "Base32-iOS"
+            ReferencedContainer = "container:Base32.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>

+ 19 - 0
Base32/Base32.h

@@ -0,0 +1,19 @@
+//
+//  Base32.h
+//  Base32
+//
+//  Created by 野村 憲男 on 1/25/15.
+//  Copyright (c) 2015 Norio Nomura. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+//! Project version number for Base32.
+FOUNDATION_EXPORT double Base32VersionNumber;
+
+//! Project version string for Base32.
+FOUNDATION_EXPORT const unsigned char Base32VersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import <Base32/PublicHeader.h>
+
+

+ 394 - 0
Base32/Base32.swift

@@ -0,0 +1,394 @@
+//
+//  Base32.swift
+//  TOTP
+//
+//  Created by 野村 憲男 on 1/24/15.
+//  Copyright (c) 2015 Norio Nomura. All rights reserved.
+//
+
+import Foundation
+
+// https://tools.ietf.org/html/rfc4648
+
+// MARK: - Base32 NSData <-> String
+
+public func base32Encode(data: NSData) -> String {
+    return base32encode(data.bytes, data.length, alphabetEncodeTable)
+}
+
+public func base32HexEncode(data: NSData) -> String {
+    return base32encode(data.bytes, data.length, extendedHexAlphabetEncodeTable)
+}
+
+public func base32DecodeToData(string: String) -> NSData? {
+    if let array = base32decode(string, alphabetDecodeTable) {
+        return NSData(bytes: array, length: array.count)
+    } else {
+        return nil
+    }
+}
+
+public func base32HexDecodeToData(string: String) -> NSData? {
+    if let array = base32decode(string, extendedHexAlphabetDecodeTable) {
+        return NSData(bytes: array, length: array.count)
+    } else {
+        return nil
+    }
+}
+
+// MARK: - Base32 [UInt8] <-> String
+
+public func base32Encode(array: [UInt8]) -> String {
+    return base32encode(array, array.count, alphabetEncodeTable)
+}
+
+public func base32HexEncode(array: [UInt8]) -> String {
+    return base32encode(array, array.count, extendedHexAlphabetEncodeTable)
+}
+
+public func base32Decode(string: String) -> [UInt8]? {
+    return base32decode(string, alphabetDecodeTable)
+}
+
+public func base32HexDecode(string: String) -> [UInt8]? {
+    return base32decode(string, extendedHexAlphabetDecodeTable)
+}
+
+// MARK: extensions
+
+extension String {
+    // base32
+    public var base32DecodedData: NSData? {
+        return base32DecodeToData(self)
+    }
+    
+    public var base32EncodedString: String {
+        let length = lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
+        return nulTerminatedUTF8.withUnsafeBufferPointer {
+            (p: UnsafeBufferPointer<UInt8>) -> String in
+            return base32encode(p.baseAddress, length, alphabetEncodeTable)
+        }
+    }
+    
+    public func base32DecodedString(encoding: NSStringEncoding = NSUTF8StringEncoding) -> String? {
+        if let data = self.base32DecodedData {
+            return NSString(data: data, encoding: NSUTF8StringEncoding) as? String
+        } else {
+            return nil
+        }
+    }
+
+    // base32Hex
+    public var base32HexDecodedData: NSData? {
+        return base32HexDecodeToData(self)
+    }
+    
+    public var base32HexEncodedString: String {
+        let length = lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
+        return nulTerminatedUTF8.withUnsafeBufferPointer {
+            (p: UnsafeBufferPointer<UInt8>) -> String in
+            return base32encode(p.baseAddress, length, extendedHexAlphabetEncodeTable)
+        }
+    }
+    
+    public func base32HexDecodedString(encoding: NSStringEncoding = NSUTF8StringEncoding) -> String? {
+        if let data = self.base32HexDecodedData {
+            return NSString(data: data, encoding: NSUTF8StringEncoding) as? String
+        } else {
+            return nil
+        }
+    }
+}
+
+extension NSData {
+    // base32
+    public var base32EncodedString: String {
+        return base32Encode(self)
+    }
+    
+    public var base32EncodedData: NSData? {
+        return base32EncodedString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
+    }
+    
+    public var base32DecodedData: NSData? {
+        if let string = NSString(data: self, encoding: NSUTF8StringEncoding) as? String {
+            return base32DecodeToData(string)
+        } else {
+            return nil
+        }
+    }
+
+    // base32Hex
+    public var base32HexEncodedString: String {
+        return base32HexEncode(self)
+    }
+    
+    public var base32HexEncodedData: NSData? {
+        return base32HexEncodedString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
+    }
+    
+    public var base32HexDecodedData: NSData? {
+        if let string = NSString(data: self, encoding: NSUTF8StringEncoding) as? String {
+            return base32HexDecodeToData(string)
+        } else {
+            return nil
+        }
+    }
+}
+
+// MARK: - private
+
+// MARK: encode
+
+extension Int8: UnicodeScalarLiteralConvertible {
+    public init(unicodeScalarLiteral value: UnicodeScalar) {
+        self.init(value.value)
+    }
+}
+
+let alphabetEncodeTable: [Int8] = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","2","3","4","5","6","7"]
+
+let extendedHexAlphabetEncodeTable: [Int8] = ["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V"]
+
+private func base32encode(data: UnsafePointer<Void>, var length: Int, table: [Int8]) -> String {
+    if length == 0 {
+        return ""
+    }
+    
+    var bytes = UnsafePointer<UInt8>(data)
+    
+    let resultBufferSize = Int(ceil(Double(length) / 5)) * 8 + 1    // need null termination
+    let resultBuffer = UnsafeMutablePointer<Int8>.alloc(resultBufferSize)
+    var encoded = resultBuffer
+    
+    // encode regular blocks
+    while length >= 5 {
+        encoded[0] = table[Int(bytes[0] >> 3)]
+        encoded[1] = table[Int((bytes[0] & 0b00000111) << 2 | bytes[1] >> 6)]
+        encoded[2] = table[Int((bytes[1] & 0b00111110) >> 1)]
+        encoded[3] = table[Int((bytes[1] & 0b00000001) << 4 | bytes[2] >> 4)]
+        encoded[4] = table[Int((bytes[2] & 0b00001111) << 1 | bytes[3] >> 7)]
+        encoded[5] = table[Int((bytes[3] & 0b01111100) >> 2)]
+        encoded[6] = table[Int((bytes[3] & 0b00000011) << 3 | bytes[4] >> 5)]
+        encoded[7] = table[Int((bytes[4] & 0b00011111))]
+        length -= 5
+        encoded = encoded.advancedBy(8)
+        bytes = bytes.advancedBy(5)
+    }
+    
+    // encode last block
+    var byte0, byte1, byte2, byte3, byte4: UInt8
+    (byte0, byte1, byte2, byte3, byte4) = (0,0,0,0,0)
+    switch length {
+    case 4:
+        byte3 = bytes[3]
+        encoded[6] = table[Int((byte3 & 0b00000011) << 3 | byte4 >> 5)]
+        encoded[5] = table[Int((byte3 & 0b01111100) >> 2)]
+        fallthrough
+    case 3:
+        byte2 = bytes[2]
+        encoded[4] = table[Int((byte2 & 0b00001111) << 1 | byte3 >> 7)]
+        fallthrough
+    case 2:
+        byte1 = bytes[1]
+        encoded[3] = table[Int((byte1 & 0b00000001) << 4 | byte2 >> 4)]
+        encoded[2] = table[Int((byte1 & 0b00111110) >> 1)]
+        fallthrough
+    case 1:
+        byte0 = bytes[0]
+        encoded[1] = table[Int((byte0 & 0b00000111) << 2 | byte1 >> 6)]
+        encoded[0] = table[Int(byte0 >> 3)]
+    default: break
+    }
+    
+    // padding
+    switch length {
+    case 0:
+        encoded[0] = 0
+    case 1:
+        encoded[2] = "="
+        encoded[3] = "="
+        fallthrough
+    case 2:
+        encoded[4] = "="
+        fallthrough
+    case 3:
+        encoded[5] = "="
+        encoded[6] = "="
+        fallthrough
+    case 4:
+        encoded[7] = "="
+        fallthrough
+    default:
+        encoded[8] = 0
+        break
+    }
+    
+    // return
+    if let base32Encoded = String(UTF8String: resultBuffer) {
+        resultBuffer.dealloc(resultBufferSize)
+        return base32Encoded
+    } else {
+        resultBuffer.dealloc(resultBufferSize)
+        fatalError("internal error")
+    }
+}
+
+// MARK: decode
+
+let __: UInt8 = 255
+let alphabetDecodeTable: [UInt8] = [
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x00 - 0x0F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x10 - 0x1F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x20 - 0x2F
+    __,__,26,27, 28,29,30,31, __,__,__,__, __,__,__,__,  // 0x30 - 0x3F
+    __, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,  // 0x40 - 0x4F
+    15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__,  // 0x50 - 0x5F
+    __, 0, 1, 2,  3, 4, 5, 6,  7, 8, 9,10, 11,12,13,14,  // 0x60 - 0x6F
+    15,16,17,18, 19,20,21,22, 23,24,25,__, __,__,__,__,  // 0x70 - 0x7F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x80 - 0x8F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x90 - 0x9F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xA0 - 0xAF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xB0 - 0xBF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xC0 - 0xCF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xD0 - 0xDF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xE0 - 0xEF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xF0 - 0xFF
+]
+
+let extendedHexAlphabetDecodeTable: [UInt8] = [
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x00 - 0x0F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x10 - 0x1F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x20 - 0x2F
+     0, 1, 2, 3,  4, 5, 6, 7,  8, 9,__,__, __,__,__,__,  // 0x30 - 0x3F
+    __,10,11,12, 13,14,15,16, 17,18,19,20, 21,22,23,24,  // 0x40 - 0x4F
+    25,26,27,28, 29,30,31,__, __,__,__,__, __,__,__,__,  // 0x50 - 0x5F
+    __,10,11,12, 13,14,15,16, 17,18,19,20, 21,22,23,24,  // 0x60 - 0x6F
+    25,26,27,28, 29,30,31,__, __,__,__,__, __,__,__,__,  // 0x70 - 0x7F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x80 - 0x8F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0x90 - 0x9F
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xA0 - 0xAF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xB0 - 0xBF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xC0 - 0xCF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xD0 - 0xDF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xE0 - 0xEF
+    __,__,__,__, __,__,__,__, __,__,__,__, __,__,__,__,  // 0xF0 - 0xFF
+]
+
+
+private func base32decode(string: String, table: [UInt8]) -> [UInt8]? {
+    let length = countElements(string.unicodeScalars)
+    if length == 0 {
+        return []
+    }
+    
+    // search element index that condition is true.
+    func index_of<C : CollectionType where C.Generator.Element : Equatable>(domain: C, condition: C.Generator.Element -> Bool) -> C.Index? {
+        return find(lazy(domain).map(condition), true)
+    }
+    
+    // calc padding length
+    func getLeastPaddingLength(string: String) -> Int {
+        if string.hasSuffix("======") {
+            return 6
+        } else if string.hasSuffix("====") {
+            return 4
+        } else if string.hasSuffix("===") {
+            return 3
+        } else if string.hasSuffix("=") {
+            return 1
+        } else {
+            return 0
+        }
+    }
+    // calc padded bytes
+    func paddedBytes(paddingLength: Int) -> Int {
+        switch paddingLength {
+        case 6: return 4
+        case 4: return 3
+        case 3: return 2
+        case 1: return 1
+        default: /* case 0:*/ return 0
+        }
+    }
+    
+    // validate string
+    let leastPaddingLength = getLeastPaddingLength(string)
+    if length % 8 != 0 {
+        println("string length is invalid.")
+        return nil
+    } else if let index = index_of(string.unicodeScalars, {$0.value > 0xff || table[Int($0.value)] > 31}) {
+        // index points padding "=" or invalid character that table does not contain.
+        let pos = distance(string.unicodeScalars.startIndex, index)
+        // if pos points padding "=", it's valid.
+        if pos != length - leastPaddingLength {
+            println("string contains some invalid characters.")
+            return nil
+        }
+    }
+    
+    // validated
+    let dataSize = length / 8 * 5 - paddedBytes(leastPaddingLength)
+    var remainEncodedLength = length - leastPaddingLength
+    
+    // Use UnsafePointer<UInt8>
+    return string.nulTerminatedUTF8.withUnsafeBufferPointer {
+        (data: UnsafeBufferPointer<UInt8>) -> [UInt8] in
+        var encoded = data.baseAddress
+        
+        let result = Array<UInt8>(count: dataSize, repeatedValue: 0)
+        var decoded = UnsafeMutablePointer<UInt8>(result)
+        
+        // decode regular blocks
+        var value0, value1, value2, value3, value4, value5, value6, value7: UInt8
+        (value0, value1, value2, value3, value4, value5, value6, value7) = (0,0,0,0,0,0,0,0)
+        while remainEncodedLength >= 8 {
+            value0 = table[Int(encoded[0])]
+            value1 = table[Int(encoded[1])]
+            value2 = table[Int(encoded[2])]
+            value3 = table[Int(encoded[3])]
+            value4 = table[Int(encoded[4])]
+            value5 = table[Int(encoded[5])]
+            value6 = table[Int(encoded[6])]
+            value7 = table[Int(encoded[7])]
+            
+            decoded[0] = value0 << 3 | value1 >> 2
+            decoded[1] = value1 << 6 | value2 << 1 | value3 >> 4
+            decoded[2] = value3 << 4 | value4 >> 1
+            decoded[3] = value4 << 7 | value5 << 2 | value6 >> 3
+            decoded[4] = value6 << 5 | value7
+            
+            remainEncodedLength -= 8
+            decoded = decoded.advancedBy(5)
+            encoded = encoded.advancedBy(8)
+        }
+        
+        // decode last block
+        (value0, value1, value2, value3, value4, value5, value6, value7) = (0,0,0,0,0,0,0,0)
+        switch remainEncodedLength {
+        case 7:
+            value6 = table[Int(encoded[6])]
+            value5 = table[Int(encoded[5])]
+            decoded[4] = value6 << 5 | value7
+            fallthrough
+        case 5:
+            value4 = table[Int(encoded[4])]
+            decoded[3] = value4 << 7 | value5 << 2 | value6 >> 3
+            fallthrough
+        case 4:
+            value3 = table[Int(encoded[3])]
+            value2 = table[Int(encoded[2])]
+            decoded[2] = value3 << 4 | value4 >> 1
+            fallthrough
+        case 2:
+            value1 = table[Int(encoded[1])]
+            value0 = table[Int(encoded[0])]
+            decoded[1] = value1 << 6 | value2 << 1 | value3 >> 4
+            decoded[0] = value0 << 3 | value1 >> 2
+        default: break
+        }
+        
+        return result
+    }
+}
+

+ 28 - 0
Base32/Info.plist

@@ -0,0 +1,28 @@
+<?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>io.github.norio-nomura.$(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>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>$(CURRENT_PROJECT_VERSION)</string>
+	<key>NSHumanReadableCopyright</key>
+	<string>Copyright © 2015 Norio Nomura. All rights reserved.</string>
+	<key>NSPrincipalClass</key>
+	<string></string>
+</dict>
+</plist>

+ 146 - 0
Base32Tests/Base32Tests.swift

@@ -0,0 +1,146 @@
+//
+//  Base32Tests.swift
+//  TOTP
+//
+//  Created by 野村 憲男 on 1/24/15.
+//  Copyright (c) 2015 Norio Nomura. All rights reserved.
+//
+
+import Foundation
+import XCTest
+import Base32
+
+class Base32Tests: XCTestCase {
+    
+    let vectors: [(String,String,String)] = [
+        ("", "", ""),
+        ("f", "MY======", "CO======"),
+        ("fo", "MZXQ====", "CPNG===="),
+        ("foo", "MZXW6===", "CPNMU==="),
+        ("foob", "MZXW6YQ=", "CPNMUOG="),
+        ("fooba", "MZXW6YTB", "CPNMUOJ1"),
+        ("foobar", "MZXW6YTBOI======", "CPNMUOJ1E8======"),
+    ]
+    
+    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()
+    }
+    
+    // MARK: https://tools.ietf.org/html/rfc4648
+    
+    func test_RFC4648_Encode() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in self.vectors {
+                    let data = test.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
+                    let result = base32Encode(data)
+                    XCTAssertEqual(result, expect, "base32Encode for \(test)")
+                }
+            }
+        }
+    }
+    
+    func test_RFC4648_Decode() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (expect, test, testHex) in self.vectors {
+                    let data = expect.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
+                    let result = base32DecodeToData(test)
+                    XCTAssertEqual(result!, data!, "base32Decode for \(test)")
+                }
+            }
+        }
+    }
+    
+    func test_RFC4648_HexEncode() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in self.vectors {
+                    let data = test.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
+                    let resultHex = base32HexEncode(data)
+                    XCTAssertEqual(resultHex, expectHex, "base32HexEncode for \(test)")
+                }
+            }
+        }
+    }
+    
+    func test_RFC4648_HexDecode() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (expect, test, testHex) in self.vectors {
+                    let data = expect.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
+                    let resultHex = base32HexDecodeToData(testHex)
+                    XCTAssertEqual(resultHex!, data!, "base32HexDecode for \(testHex)")
+                }
+            }
+        }
+    }
+    
+    // MARK: -
+    
+    func test_ExtensionString() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in self.vectors {
+                    let result = test.base32EncodedString
+                    let resultHex = test.base32HexEncodedString
+                    XCTAssertEqual(result, expect, "\(test).base32EncodedString")
+                    XCTAssertEqual(resultHex, expectHex, "\(test).base32HexEncodedString")
+                    let decoded = result.base32DecodedString()
+                    let decodedHex = resultHex.base32HexDecodedString()
+                    XCTAssertEqual(decoded!, test, "\(result).base32DecodedString()")
+                    XCTAssertEqual(decodedHex!, test, "\(resultHex).base32HexDecodedString()")
+                }
+            }
+        }
+    }
+    
+    func test_ExtensionData() {
+        let dataVectors = vectors.map {
+            (
+                $0.dataUsingEncoding(NSUTF8StringEncoding)!,
+                $1.dataUsingEncoding(NSUTF8StringEncoding)!,
+                $2.dataUsingEncoding(NSUTF8StringEncoding)!
+            )
+        }
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in dataVectors {
+                    let result = test.base32EncodedData
+                    let resultHex = test.base32HexEncodedData
+                    XCTAssertEqual(result!, expect, "\(test).base32EncodedData")
+                    XCTAssertEqual(resultHex!, expectHex, "\(test).base32HexEncodedData")
+                    let decoded = result!.base32DecodedData
+                    let decodedHex = resultHex!.base32HexDecodedData
+                    XCTAssertEqual(decoded!, test, "\(result).base32DecodedData")
+                    XCTAssertEqual(decodedHex!, test, "\(resultHex).base32HexDecodedData")
+                }
+            }
+        }
+    }
+    
+    func test_ExtensionDataAndString() {
+        let dataAndStringVectors = vectors.map {($0.dataUsingEncoding(NSUTF8StringEncoding)!, $1, $2)}
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in dataAndStringVectors {
+                    let result = test.base32EncodedString
+                    let resultHex = test.base32HexEncodedString
+                    XCTAssertEqual(result, expect, "\(test).base32EncodedString")
+                    XCTAssertEqual(resultHex, expectHex, "\(test).base32HexEncodedString")
+                    let decoded = result.base32DecodedData
+                    let decodedHex = resultHex.base32HexDecodedData
+                    XCTAssertEqual(decoded!, test, "\(result).base32DecodedData")
+                    XCTAssertEqual(decodedHex!, test, "\(resultHex).base32HexDecodedData")
+                }
+            }
+        }
+    }
+    
+}

+ 24 - 0
Base32Tests/Info.plist

@@ -0,0 +1,24 @@
+<?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>io.github.norio-nomura.$(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 - 0
Cartfile

@@ -0,0 +1 @@
+github "jspahrsummers/xcconfigs"

+ 1 - 0
Cartfile.resolved

@@ -0,0 +1 @@
+github "jspahrsummers/xcconfigs" "0.7.1"

+ 174 - 0
Carthage/Checkouts/xcconfigs/Base/Common.xcconfig

@@ -0,0 +1,174 @@
+// 
+// This file defines common settings that should be enabled for every new
+// project. Typically, you want to use Debug, Release, or a similar variant
+// instead.
+//
+
+// Disable legacy-compatible header searching
+ALWAYS_SEARCH_USER_PATHS = NO
+
+// Architectures to build
+ARCHS = $(ARCHS_STANDARD)
+
+// Whether to warn when a floating-point value is used as a loop counter
+CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES
+
+// Whether to warn about use of rand() and random() being used instead of arc4random()
+CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES
+
+// Whether to warn about strcpy() and strcat()
+CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES
+
+// Whether to enable module imports
+CLANG_ENABLE_MODULES = YES
+
+// Enable ARC
+CLANG_ENABLE_OBJC_ARC = YES
+
+// Warn about implicit conversions to boolean values that are suspicious.
+// For example, writing 'if (foo)' with 'foo' being the name a function will trigger a warning.
+CLANG_WARN_BOOL_CONVERSION = YES
+
+// Warn about implicit conversions of constant values that cause the constant value to change,
+// either through a loss of precision, or entirely in its meaning.
+CLANG_WARN_CONSTANT_CONVERSION = YES
+
+// Whether to warn when overriding deprecated methods
+CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES
+
+// Warn about direct accesses to the Objective-C 'isa' pointer instead of using a runtime API.
+CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR
+
+// Warn about declaring the same method more than once within the same @interface.
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
+
+// Warn about loop bodies that are suspiciously empty.
+CLANG_WARN_EMPTY_BODY = YES
+
+// Warn about implicit conversions between different kinds of enum values.
+// For example, this can catch issues when using the wrong enum flag as an argument to a function or method.
+CLANG_WARN_ENUM_CONVERSION = YES
+
+// Whether to warn on implicit conversions between signed/unsigned types
+CLANG_WARN_IMPLICIT_SIGN_CONVERSION = NO
+
+// Warn about implicit conversions between pointers and integers.
+// For example, this can catch issues when one incorrectly intermixes using NSNumbers and raw integers.
+CLANG_WARN_INT_CONVERSION = YES
+
+// Don't warn about repeatedly using a weak reference without assigning the weak reference to a strong reference. Too many false positives.
+CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = NO
+
+// Warn about classes that unintentionally do not subclass a root class (such as NSObject).
+CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR
+
+// Whether to warn on suspicious implicit conversions
+CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES
+
+// Warn about potentially unreachable code
+CLANG_WARN_UNREACHABLE_CODE = YES
+
+// The format of debugging symbols
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
+
+// Whether to compile assertions in
+ENABLE_NS_ASSERTIONS = YES
+
+// Whether to require objc_msgSend to be cast before invocation
+ENABLE_STRICT_OBJC_MSGSEND = YES
+
+// Which C variant to use
+GCC_C_LANGUAGE_STANDARD = gnu99
+
+// Whether to enable exceptions for Objective-C
+GCC_ENABLE_OBJC_EXCEPTIONS = YES
+
+// Whether to generate debugging symbols
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES
+
+// Whether to precompile the prefix header (if one is specified)
+GCC_PRECOMPILE_PREFIX_HEADER = YES
+
+// Whether to enable strict aliasing, meaning that two pointers of different
+// types (other than void * or any id type) cannot point to the same memory
+// location
+GCC_STRICT_ALIASING = YES
+
+// Whether symbols not explicitly exported are hidden by default (this primarily
+// only affects C++ code)
+GCC_SYMBOLS_PRIVATE_EXTERN = NO
+
+// Whether static variables are thread-safe by default
+GCC_THREADSAFE_STATICS = NO
+
+// Which compiler to use
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0
+
+// Whether warnings are treated as errors
+GCC_TREAT_WARNINGS_AS_ERRORS = YES
+
+// Whether to warn about 64-bit values being implicitly shortened to 32 bits
+GCC_WARN_64_TO_32_BIT_CONVERSION = YES
+
+// Whether to warn about fields missing from structure initializers (only if
+// designated initializers aren't used)
+GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES
+
+// Whether to warn about missing function prototypes
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO
+
+// Whether to warn about implicit conversions in the signedness of the type
+// a pointer is pointing to (e.g., 'int *' getting converted to 'unsigned int *')
+GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES
+
+// Whether to warn when the value returned from a function/method/block does not
+// match its return type
+GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR
+
+// Whether to warn on a class not implementing all the required methods of
+// a protocol it declares conformance to
+GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES
+
+// Whether to warn when switching on an enum value, and all possibilities are
+// not accounted for
+GCC_WARN_CHECK_SWITCH_STATEMENTS = YES
+
+// Whether to warn about the use of four-character constants
+GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES
+
+// Whether to warn about an aggregate data type's initializer not being fully
+// bracketed (e.g., array initializer syntax)
+GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES
+
+// Whether to warn about missing braces or parentheses that make the meaning of
+// the code ambiguous
+GCC_WARN_MISSING_PARENTHESES = YES
+
+// Whether to warn about unsafe comparisons between values of different
+// signedness
+GCC_WARN_SIGN_COMPARE = YES
+
+// Whether to warn about the arguments to printf-style functions not matching
+// the format specifiers
+GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES
+
+// Warn if a "@selector(...)" expression referring to an undeclared selector is found
+GCC_WARN_UNDECLARED_SELECTOR = YES
+
+// Warn if a variable might be clobbered by a setjmp call or if an automatic variable is used without prior initialization.
+GCC_WARN_UNINITIALIZED_AUTOS = YES
+
+// Whether to warn about static functions that are unused
+GCC_WARN_UNUSED_FUNCTION = YES
+
+// Whether to warn about labels that are unused
+GCC_WARN_UNUSED_LABEL = YES
+
+// Whether to warn about variables that are never used
+GCC_WARN_UNUSED_VARIABLE = YES
+
+// Whether to run the static analyzer with every build
+RUN_CLANG_STATIC_ANALYZER = YES
+
+// Don't treat unknown warnings as errors, and disable GCC compatibility warnings and unused static const variable warnings
+WARNING_CFLAGS = -Wno-error=unknown-warning-option -Wno-gcc-compat -Wno-unused-const-variable

+ 43 - 0
Carthage/Checkouts/xcconfigs/Base/Configurations/Debug.xcconfig

@@ -0,0 +1,43 @@
+// 
+// This file defines the base configuration for a Debug build of any project.
+// This should be set at the project level for the Debug configuration.
+//
+
+#include "../Common.xcconfig"
+
+// Whether to strip debugging symbols when copying resources (like included
+// binaries)
+COPY_PHASE_STRIP = NO
+
+// The optimization level (0, 1, 2, 3, s) for the produced binary
+GCC_OPTIMIZATION_LEVEL = 0
+
+// Preproccessor definitions to apply to each file compiled
+GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
+
+// Whether to enable link-time optimizations (such as inlining across translation
+// units)
+LLVM_LTO = NO
+
+// Whether to only build the active architecture
+ONLY_ACTIVE_ARCH = YES
+
+// Other compiler flags
+// 
+// These settings catch some errors in integer arithmetic
+OTHER_CFLAGS = -ftrapv
+
+// Other flags to pass to the Swift compiler
+//
+// This enables conditional compilation with #if DEBUG
+OTHER_SWIFT_FLAGS = -D DEBUG
+
+// Whether to strip debugging symbols when copying the built product to its
+// final installation location
+STRIP_INSTALLED_PRODUCT = NO
+
+// The optimization level (-Onone, -O, -Ofast) for the produced Swift binary
+SWIFT_OPTIMIZATION_LEVEL = -Onone
+
+// Disable Developer ID timestamping
+OTHER_CODE_SIGN_FLAGS = --timestamp=none

+ 27 - 0
Carthage/Checkouts/xcconfigs/Base/Configurations/Profile.xcconfig

@@ -0,0 +1,27 @@
+// 
+// This file defines the base configuration for an optional profiling-specific
+// build of any project. To use these settings, create a Profile configuration
+// in your project, and use this file at the project level for the new
+// configuration.
+//
+
+// based on the Release configuration, with some stuff related to debugging
+// symbols re-enabled
+#include "Release.xcconfig"
+
+// Whether to strip debugging symbols when copying resources (like included
+// binaries)
+COPY_PHASE_STRIP = NO
+
+// Whether to only build the active architecture
+ONLY_ACTIVE_ARCH = YES
+
+// Whether to strip debugging symbols when copying the built product to its
+// final installation location
+STRIP_INSTALLED_PRODUCT = NO
+
+// Whether to perform App Store validation checks
+VALIDATE_PRODUCT = NO
+
+// Disable Developer ID timestamping
+OTHER_CODE_SIGN_FLAGS = --timestamp=none

+ 33 - 0
Carthage/Checkouts/xcconfigs/Base/Configurations/Release.xcconfig

@@ -0,0 +1,33 @@
+// 
+// This file defines the base configuration for a Release build of any project.
+// This should be set at the project level for the Release configuration.
+//
+
+#include "../Common.xcconfig"
+
+// Whether to strip debugging symbols when copying resources (like included
+// binaries)
+COPY_PHASE_STRIP = YES
+
+// The optimization level (0, 1, 2, 3, s) for the produced binary
+GCC_OPTIMIZATION_LEVEL = s
+
+// Preproccessor definitions to apply to each file compiled
+GCC_PREPROCESSOR_DEFINITIONS = NDEBUG=1
+
+// Whether to enable link-time optimizations (such as inlining across translation
+// units)
+LLVM_LTO = NO
+
+// Whether to only build the active architecture
+ONLY_ACTIVE_ARCH = NO
+
+// Whether to strip debugging symbols when copying the built product to its
+// final installation location
+STRIP_INSTALLED_PRODUCT = YES
+
+// The optimization level (-Onone, -O, -Ofast) for the produced Swift binary
+SWIFT_OPTIMIZATION_LEVEL = -O
+
+// Whether to perform App Store validation checks
+VALIDATE_PRODUCT = YES

+ 10 - 0
Carthage/Checkouts/xcconfigs/Base/Configurations/Test.xcconfig

@@ -0,0 +1,10 @@
+// 
+// This file defines the base configuration for a Test build of any project.
+// This should be set at the project level for the Test configuration.
+//
+
+#include "Debug.xcconfig"
+
+// Sandboxed apps can't be unit tested since they can't load some random 
+// external bundle. So we disable sandboxing for testing.
+CODE_SIGN_ENTITLEMENTS = 

+ 12 - 0
Carthage/Checkouts/xcconfigs/Base/Targets/Application.xcconfig

@@ -0,0 +1,12 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for an application. Typically, you want to use a platform-specific variant
+// instead.
+//
+
+// Whether to strip out code that isn't called from anywhere
+DEAD_CODE_STRIPPING = NO
+
+// Sets the @rpath for the application such that it can include frameworks in
+// the application bundle (inside the "Frameworks" folder)
+LD_RUNPATH_SEARCH_PATHS = @executable_path/../Frameworks @loader_path/../Frameworks @executable_path/Frameworks

+ 26 - 0
Carthage/Checkouts/xcconfigs/Base/Targets/Framework.xcconfig

@@ -0,0 +1,26 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a framework. Typically, you want to use a platform-specific variant
+// instead.
+//
+
+// Whether to strip out code that isn't called from anywhere
+DEAD_CODE_STRIPPING = NO
+
+// Whether this framework should define an LLVM module
+DEFINES_MODULE = YES
+
+// Whether function calls should be position-dependent (should always be
+// disabled for library code)
+GCC_DYNAMIC_NO_PIC = NO
+
+// Default frameworks to the name of the project, instead of any
+// platform-specific target
+PRODUCT_NAME = $(PROJECT_NAME)
+
+// Enables the framework to be included from any location as long as the
+// loader’s runpath search paths includes it. For example from an application
+// bundle (inside the "Frameworks" folder) or shared folder
+INSTALL_PATH = @rpath
+LD_DYLIB_INSTALL_NAME = @rpath/$(PRODUCT_NAME).$(WRAPPER_EXTENSION)/$(PRODUCT_NAME)
+SKIP_INSTALL = YES

+ 26 - 0
Carthage/Checkouts/xcconfigs/Base/Targets/StaticLibrary.xcconfig

@@ -0,0 +1,26 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a static library. Typically, you want to use a platform-specific variant
+// instead.
+//
+
+// Whether to strip out code that isn't called from anywhere
+DEAD_CODE_STRIPPING = NO
+
+// Whether to strip debugging symbols when copying resources (like included
+// binaries).
+//
+// Overrides Release.xcconfig when used at the target level.
+COPY_PHASE_STRIP = NO
+
+// Whether function calls should be position-dependent (should always be
+// disabled for library code)
+GCC_DYNAMIC_NO_PIC = NO
+
+// Copy headers to "include/LibraryName" in the build folder by default. This
+// lets consumers use #import <LibraryName/LibraryName.h> syntax even for static
+// libraries
+PUBLIC_HEADERS_FOLDER_PATH = include/$PRODUCT_NAME
+
+// Don't include in an xcarchive
+SKIP_INSTALL = YES

+ 1 - 0
Carthage/Checkouts/xcconfigs/Carthage/Build

@@ -0,0 +1 @@
+/Users/norio/Documents/workspace/github/Base32/Carthage/Build

+ 15 - 0
Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Application.xcconfig

@@ -0,0 +1,15 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for an application on Mac OS X. This should be set at the target level for
+// each project configuration.
+//
+
+// Import base application settings
+#include "../Base/Targets/Application.xcconfig"
+
+// Apply common settings specific to Mac OS X
+#include "Mac-Base.xcconfig"
+
+// Whether function calls should be position-dependent (should always be
+// disabled for library code)
+GCC_DYNAMIC_NO_PIC = YES

+ 19 - 0
Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Base.xcconfig

@@ -0,0 +1,19 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for Mac OS X. This file is not standalone -- it is meant to be included into
+// a configuration file for a specific type of target.
+//
+
+// Whether to combine multiple image resolutions into a multirepresentational
+// TIFF
+COMBINE_HIDPI_IMAGES = YES
+
+// Where to find embedded frameworks
+LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/../Frameworks @loader_path/../Frameworks
+
+// The base SDK to use (if no version is specified, the latest version is
+// assumed)
+SDKROOT = macosx
+
+// Supported build architectures
+VALID_ARCHS = x86_64

+ 18 - 0
Carthage/Checkouts/xcconfigs/Mac OS X/Mac-DynamicLibrary.xcconfig

@@ -0,0 +1,18 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a dynamic library. This should be set at the target level for each
+// project configuration.
+//
+
+// Import common settings specific to Mac OS X
+#include "Mac-Base.xcconfig"
+
+// Whether to strip out code that isn't called from anywhere
+DEAD_CODE_STRIPPING = NO
+
+// Whether function calls should be position-dependent (should always be
+// disabled for library code)
+GCC_DYNAMIC_NO_PIC = NO
+
+// Don't include in an xcarchive
+SKIP_INSTALL = YES

+ 11 - 0
Carthage/Checkouts/xcconfigs/Mac OS X/Mac-Framework.xcconfig

@@ -0,0 +1,11 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a framework on OS X. This should be set at the target level for each
+// project configuration.
+//
+
+// Import base framework settings
+#include "../Base/Targets/Framework.xcconfig"
+
+// Import common settings specific to Mac OS X
+#include "Mac-Base.xcconfig"

+ 11 - 0
Carthage/Checkouts/xcconfigs/Mac OS X/Mac-StaticLibrary.xcconfig

@@ -0,0 +1,11 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a static library on Mac OS X. This should be set at the target level for
+// each project configuration.
+//
+
+// Import base static library settings
+#include "../Base/Targets/StaticLibrary.xcconfig"
+
+// Apply common settings specific to Mac OS X
+#include "Mac-Base.xcconfig"

+ 13 - 0
Carthage/Checkouts/xcconfigs/README.md

@@ -0,0 +1,13 @@
+This project intends to aggregate common or universal Xcode configuration settings, keeping them in hierarchial Xcode configuration files for easy modification and reuse.
+
+## License
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
+
+In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
+
+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 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.
+
+For more information, please refer to [unlicense.org](http://unlicense.org).

+ 11 - 0
Carthage/Checkouts/xcconfigs/iOS/iOS-Application.xcconfig

@@ -0,0 +1,11 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for an application on iOS. This should be set at the target level for each
+// project configuration.
+//
+
+// Import base application settings
+#include "../Base/Targets/Application.xcconfig"
+
+// Apply common settings specific to iOS
+#include "iOS-Base.xcconfig"

+ 15 - 0
Carthage/Checkouts/xcconfigs/iOS/iOS-Base.xcconfig

@@ -0,0 +1,15 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for iOS. This file is not standalone -- it is meant to be included into
+// a configuration file for a specific type of target.
+//
+
+// Xcode needs this to find archived headers if SKIP_INSTALL is set
+HEADER_SEARCH_PATHS = $(OBJROOT)/UninstalledProducts/include
+
+// Where to find embedded frameworks
+LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks
+
+// The base SDK to use (if no version is specified, the latest version is
+// assumed)
+SDKROOT = iphoneos

+ 11 - 0
Carthage/Checkouts/xcconfigs/iOS/iOS-Framework.xcconfig

@@ -0,0 +1,11 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a framework. This should be set at the target level for each project
+// configuration.
+//
+
+// Import base framework settings
+#include "../Base/Targets/Framework.xcconfig"
+
+// Import common settings specific to iOS
+#include "iOS-Base.xcconfig"

+ 14 - 0
Carthage/Checkouts/xcconfigs/iOS/iOS-StaticLibrary.xcconfig

@@ -0,0 +1,14 @@
+//
+// This file defines additional configuration options that are appropriate only
+// for a static library on iOS. This should be set at the target level for each
+// project configuration.
+//
+
+// Import base static library settings
+#include "../Base/Targets/StaticLibrary.xcconfig"
+
+// Apply common settings specific to iOS
+#include "iOS-Base.xcconfig"
+
+// Supported device families (1 is iPhone, 2 is iPad)
+TARGETED_DEVICE_FAMILY = 1,2

+ 6 - 0
Gemfile

@@ -0,0 +1,6 @@
+# A sample Gemfile
+source "https://rubygems.org"
+
+gem "rake"
+gem 'xcpretty'
+gem "xcjobs", :git => 'https://github.com/norio-nomura/xcjobs.git', :branch => 'subclass-of-rake-task'

+ 20 - 0
Gemfile.lock

@@ -0,0 +1,20 @@
+GIT
+  remote: https://github.com/norio-nomura/xcjobs.git
+  revision: ebfe8050aac3bf95dfcd6d1bdcb4dc9dc8358c56
+  branch: subclass-of-rake-task
+  specs:
+    xcjobs (0.0.4)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    rake (10.4.2)
+    xcpretty (0.1.7)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  rake
+  xcjobs!
+  xcpretty

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Norio Nomura
+
+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.

+ 26 - 0
README.md

@@ -0,0 +1,26 @@
+# Base32 for Swift on OS X and iOS
+[![CI Status](http://img.shields.io/travis/norio-nomura/Base32.svg?style=flat)](https://travis-ci.org/norio-nomura/Base32)
+
+Base32 is a [Base32](https://tools.ietf.org/html/rfc4648) implementation for Swift.
+
+## Requirements
+
+iOS 8 or later
+OS X 10.10 or later
+
+## Installation
+
+### Carthage
+
+Base32 is available through [Carthage](https://github.com/Carthage/Carthage). To install
+it, simply add the following line to your Cartfile:
+
+`github "norio-nomura/Base32"`
+
+## Author
+
+Norio Nomura
+
+## License
+
+Base32 is available under the MIT license. See the LICENSE file for more info.

+ 44 - 0
Rakefile

@@ -0,0 +1,44 @@
+require 'xcjobs'
+
+def destinations
+  [ 'name=iPad 2,OS=8.1',
+    'name=iPad Air,OS=8.1',
+    'name=iPhone 4s,OS=8.1',
+    'name=iPhone 5,OS=8.1',
+    'name=iPhone 5s,OS=8.1',
+    'name=iPhone 6,OS=8.1',
+    'name=iPhone 6 Plus,OS=8.1'
+  ]
+end
+
+namespace :test do
+  xcode_test :ios do |t|
+    t.project = 'Base32'
+    t.scheme = 'Base32-iOS'
+    t.sdk = 'iphonesimulator'
+    t.configuration = 'Release'
+    t.build_dir = 'build'
+    destinations.each do |destination|
+      t.add_destination(destination)
+    end
+    t.formatter = 'xcpretty -c'
+  end
+
+  xcode_test :osx do |t|
+    t.project = 'Base32'
+    t.scheme = 'Base32-Mac'
+    t.sdk = 'macosx'
+    t.configuration = 'Release'
+    t.build_dir = 'build'
+    t.formatter = 'xcpretty -c'
+  end
+
+  xcode_test :SecEncodeTransformTests do |t|
+    t.project = 'Base32'
+    t.scheme = 'SecEncodeTransformTests'
+    t.sdk = 'macosx'
+    t.configuration = 'Release'
+    t.build_dir = 'build'
+    t.formatter = 'xcpretty -c'
+  end
+end

+ 24 - 0
SecEncodeTransformTests/Info.plist

@@ -0,0 +1,24 @@
+<?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>io.github.norio-nomura.$(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>

+ 77 - 0
SecEncodeTransformTests/SecEncodeTransformTests.swift

@@ -0,0 +1,77 @@
+//
+//  SecEncodeTransformTests.swift
+//  Base32
+//
+//  Created by 野村 憲男 on 1/25/15.
+//  Copyright (c) 2015 Norio Nomura. All rights reserved.
+//
+
+import Foundation
+import XCTest
+import Security
+
+public func base32EncodeUsingSecEncodeTransform(data: NSData) -> String {
+    var transform = SecEncodeTransformCreate(kSecBase32Encoding, nil)
+    SecTransformSetAttribute(transform.takeUnretainedValue(), kSecTransformInputAttributeName, data, nil)
+    let encodedData = SecTransformExecute(transform.takeUnretainedValue(), nil) as NSData
+    transform.release()
+    return NSString(data: encodedData, encoding: NSUTF8StringEncoding) as String
+}
+
+public func base32DecodeToDataUsingSecEncodeTransform(string: String) -> NSData? {
+    var transform = SecDecodeTransformCreate(kSecBase32Encoding, nil)
+    SecTransformSetAttribute(transform.takeUnretainedValue(), kSecTransformInputAttributeName, string.dataUsingEncoding(NSUTF8StringEncoding), nil)
+    let decodedData = SecTransformExecute(transform.takeUnretainedValue(), nil) as NSData
+    transform.release()
+    return decodedData
+}
+
+class SecEncodeTransformTests: XCTestCase {
+    
+    let vectors: [(String,String,String)] = [
+        ("", "", ""),
+        ("f", "MY======", "CO======"),
+        ("fo", "MZXQ====", "CPNG===="),
+        ("foo", "MZXW6===", "CPNMU==="),
+        ("foob", "MZXW6YQ=", "CPNMUOG="),
+        ("fooba", "MZXW6YTB", "CPNMUOJ1"),
+        ("foobar", "MZXW6YTBOI======", "CPNMUOJ1E8======"),
+    ]
+    
+    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()
+    }
+    
+    // MARK: https://tools.ietf.org/html/rfc4648
+    
+    // MARK: Using SecEncodeTransform
+    func test_RFC4648_Encode_UsingSecEncodeTransform() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (test, expect, expectHex) in self.vectors {
+                    let data = test.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!
+                    let result = base32EncodeUsingSecEncodeTransform(data)
+                    XCTAssertEqual(result, expect, "base32EncodeUsingSecEncodeTransform for \(test)")
+                }
+            }
+        }
+    }
+    
+    func test_RFC4648_DecodeUsingSecEncodeTransform() {
+        self.measureBlock{
+            for _ in 0...100 {
+                for (expect, test, testHex) in self.vectors {
+                    let data = expect.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)
+                    let result = base32DecodeToDataUsingSecEncodeTransform(test)
+                    XCTAssertEqual(result!, data!, "base32DecodeUsingSecEncodeTransform for \(test)")
+                }
+            }
+        }
+    }
+}