From c9e4ae5136329f50a3373e43dc111432ef0bbef0 Mon Sep 17 00:00:00 2001 From: Alex Vlasov Date: Tue, 7 Aug 2018 15:46:43 +0300 Subject: [PATCH] First release --- EllipticSwift.podspec | 26 + EllipticSwift.xcodeproj/project.pbxproj | 1032 +++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + EllipticSwift/Curve/AffineCoordinates.swift | 31 + EllipticSwift/Curve/CurveProtocols.swift | 75 + EllipticSwift/Curve/GeneralizedPoint.swift | 149 ++ .../Curve/GeneralizedWeirstrassCurve.swift | 321 ++++ EllipticSwift/Curve/PrecompiledCurves.swift | 40 + EllipticSwift/EllipticSwift.h | 19 + EllipticSwift/Extensions/Data+Bytes.swift | 15 + EllipticSwift/Field/FieldProtocols.swift | 82 + .../Field/GeneralizedMontPrimeField.swift | 262 +++ .../Field/GeneralizedNaivePrimeField.swift | 237 +++ .../Field/GeneralizedPrimeFieldElement.swift | 141 ++ .../FixedWidthTypes/FiniteWidthInteger.swift | 73 + .../U128/U128+BitAccessible.swift | 27 + .../U128/U128+Comparable.swift | 17 + .../FixedWidthTypes/U128/U128+Equatable.swift | 16 + EllipticSwift/FixedWidthTypes/U128/U128.swift | 92 + .../FixedWidthTypes/U256/U256+Add.swift | 26 + .../FixedWidthTypes/U256/U256+Aux.swift | 20 + .../U256/U256+BitAccessible.swift | 47 + .../FixedWidthTypes/U256/U256+BitOps.swift | 61 + .../U256/U256+Comparable.swift | 30 + .../FixedWidthTypes/U256/U256+Div.swift | 21 + .../FixedWidthTypes/U256/U256+Equatable.swift | 17 + .../FixedWidthTypes/U256/U256+Mod.swift | 84 + .../FixedWidthTypes/U256/U256+Mont.swift | 79 + .../FixedWidthTypes/U256/U256+Mul.swift | 34 + .../FixedWidthTypes/U256/U256+Numeric.swift | 60 + .../FixedWidthTypes/U256/U256+Sub.swift | 26 + EllipticSwift/FixedWidthTypes/U256/U256.swift | 69 + .../FixedWidthTypes/U512/U512+Add.swift | 26 + .../FixedWidthTypes/U512/U512+Aux.swift | 20 + .../FixedWidthTypes/U512/U512+Div.swift | 21 + .../FixedWidthTypes/U512/U512+Mod.swift | 36 + .../FixedWidthTypes/U512/U512+Mul.swift | 34 + .../FixedWidthTypes/U512/U512+Sub.swift | 26 + EllipticSwift/FixedWidthTypes/U512/U512.swift | 66 + EllipticSwift/FixedWidthTypes/UInt32.swift | 37 + EllipticSwift/FixedWidthTypes/vUInt32.swift | 102 ++ EllipticSwift/Info.plist | 26 + EllipticSwift/WindowMethods/Constants.swift | 12 + .../WindowMethods/windowMethods.swift | 138 ++ EllipticSwiftTests/EllipticSwiftTests.swift | 516 ++++++ EllipticSwiftTests/Info.plist | 22 + EllipticSwift_iOS/EllipticSwift_iOS.h | 19 + EllipticSwift_iOS/Info.plist | 24 + LICENSE | 13 + Podfile | 22 + Podfile.lock | 20 + Pods/BigInt/LICENSE.md | 20 + Pods/BigInt/README.md | 435 +++++ Pods/BigInt/sources/Addition.swift | 126 ++ Pods/BigInt/sources/BigInt.swift | 76 + Pods/BigInt/sources/BigUInt.swift | 386 ++++ Pods/BigInt/sources/Bitwise Ops.swift | 121 ++ Pods/BigInt/sources/Codable.swift | 155 ++ Pods/BigInt/sources/Comparable.swift | 63 + Pods/BigInt/sources/Data Conversion.swift | 107 ++ Pods/BigInt/sources/Division.swift | 374 ++++ Pods/BigInt/sources/Exponentiation.swift | 119 ++ .../sources/Floating Point Conversion.swift | 73 + Pods/BigInt/sources/GCD.swift | 80 + Pods/BigInt/sources/Hashable.swift | 28 + Pods/BigInt/sources/Integer Conversion.swift | 89 + Pods/BigInt/sources/Multiplication.swift | 165 ++ Pods/BigInt/sources/Prime Test.swift | 153 ++ Pods/BigInt/sources/Random.swift | 71 + Pods/BigInt/sources/Shifts.swift | 211 +++ Pods/BigInt/sources/Square Root.swift | 41 + Pods/BigInt/sources/Strideable.swift | 38 + Pods/BigInt/sources/String Conversion.swift | 242 +++ Pods/BigInt/sources/Subtraction.swift | 169 ++ Pods/BigInt/sources/Words and Bits.swift | 202 +++ Pods/Manifest.lock | 20 + Pods/Pods.xcodeproj/project.pbxproj | 1582 +++++++++++++++++ Pods/SipHash/LICENSE.md | 21 + Pods/SipHash/README.md | 161 ++ Pods/SipHash/SipHash/Primitive Types.swift | 171 ++ Pods/SipHash/SipHash/RandomUInt64.swift | 39 + Pods/SipHash/SipHash/SipHashable.swift | 65 + Pods/SipHash/SipHash/SipHasher.swift | 197 ++ .../BigInt-iOS/BigInt-iOS-dummy.m | 5 + .../BigInt-iOS/BigInt-iOS-prefix.pch | 12 + .../BigInt-iOS/BigInt-iOS-umbrella.h | 16 + .../BigInt-iOS/BigInt-iOS.modulemap | 6 + .../BigInt-iOS/BigInt-iOS.xcconfig | 10 + .../BigInt-iOS/Info.plist | 26 + .../BigInt-macOS/BigInt-macOS-dummy.m | 5 + .../BigInt-macOS/BigInt-macOS-prefix.pch | 12 + .../BigInt-macOS/BigInt-macOS-umbrella.h | 16 + .../BigInt-macOS/BigInt-macOS.modulemap | 6 + .../BigInt-macOS/BigInt-macOS.xcconfig | 11 + .../BigInt-macOS/Info.plist | 26 + .../Pods-EllipticSwift/Info.plist | 26 + ...ds-EllipticSwift-acknowledgements.markdown | 52 + .../Pods-EllipticSwift-acknowledgements.plist | 90 + .../Pods-EllipticSwift-dummy.m | 5 + .../Pods-EllipticSwift-resources.sh | 118 ++ .../Pods-EllipticSwift-umbrella.h | 16 + .../Pods-EllipticSwift.debug.xcconfig | 11 + .../Pods-EllipticSwift.modulemap | 6 + .../Pods-EllipticSwift.release.xcconfig | 11 + .../Pods-EllipticSwiftTests/Info.plist | 26 + ...lipticSwiftTests-acknowledgements.markdown | 52 + ...-EllipticSwiftTests-acknowledgements.plist | 90 + .../Pods-EllipticSwiftTests-dummy.m | 5 + .../Pods-EllipticSwiftTests-frameworks.sh | 155 ++ .../Pods-EllipticSwiftTests-resources.sh | 118 ++ .../Pods-EllipticSwiftTests-umbrella.h | 16 + .../Pods-EllipticSwiftTests.debug.xcconfig | 12 + .../Pods-EllipticSwiftTests.modulemap | 6 + .../Pods-EllipticSwiftTests.release.xcconfig | 12 + .../Pods-EllipticSwift_iOS/Info.plist | 26 + ...llipticSwift_iOS-acknowledgements.markdown | 52 + ...s-EllipticSwift_iOS-acknowledgements.plist | 90 + .../Pods-EllipticSwift_iOS-dummy.m | 5 + .../Pods-EllipticSwift_iOS-resources.sh | 118 ++ .../Pods-EllipticSwift_iOS-umbrella.h | 16 + .../Pods-EllipticSwift_iOS.debug.xcconfig | 10 + .../Pods-EllipticSwift_iOS.modulemap | 6 + .../Pods-EllipticSwift_iOS.release.xcconfig | 10 + .../SipHash-iOS/Info.plist | 26 + .../SipHash-iOS/SipHash-iOS-dummy.m | 5 + .../SipHash-iOS/SipHash-iOS-prefix.pch | 12 + .../SipHash-iOS/SipHash-iOS-umbrella.h | 16 + .../SipHash-iOS/SipHash-iOS.modulemap | 6 + .../SipHash-iOS/SipHash-iOS.xcconfig | 9 + .../SipHash-macOS/Info.plist | 26 + .../SipHash-macOS/SipHash-macOS-dummy.m | 5 + .../SipHash-macOS/SipHash-macOS-prefix.pch | 12 + .../SipHash-macOS/SipHash-macOS-umbrella.h | 16 + .../SipHash-macOS/SipHash-macOS.modulemap | 6 + .../SipHash-macOS/SipHash-macOS.xcconfig | 10 + README.md | 1 + 139 files changed, 11703 insertions(+) create mode 100644 EllipticSwift.podspec create mode 100644 EllipticSwift.xcodeproj/project.pbxproj create mode 100644 EllipticSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 EllipticSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 EllipticSwift.xcworkspace/contents.xcworkspacedata create mode 100644 EllipticSwift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 EllipticSwift/Curve/AffineCoordinates.swift create mode 100644 EllipticSwift/Curve/CurveProtocols.swift create mode 100644 EllipticSwift/Curve/GeneralizedPoint.swift create mode 100644 EllipticSwift/Curve/GeneralizedWeirstrassCurve.swift create mode 100644 EllipticSwift/Curve/PrecompiledCurves.swift create mode 100644 EllipticSwift/EllipticSwift.h create mode 100644 EllipticSwift/Extensions/Data+Bytes.swift create mode 100644 EllipticSwift/Field/FieldProtocols.swift create mode 100644 EllipticSwift/Field/GeneralizedMontPrimeField.swift create mode 100644 EllipticSwift/Field/GeneralizedNaivePrimeField.swift create mode 100644 EllipticSwift/Field/GeneralizedPrimeFieldElement.swift create mode 100644 EllipticSwift/FixedWidthTypes/FiniteWidthInteger.swift create mode 100644 EllipticSwift/FixedWidthTypes/U128/U128+BitAccessible.swift create mode 100644 EllipticSwift/FixedWidthTypes/U128/U128+Comparable.swift create mode 100644 EllipticSwift/FixedWidthTypes/U128/U128+Equatable.swift create mode 100644 EllipticSwift/FixedWidthTypes/U128/U128.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Add.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Aux.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+BitAccessible.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+BitOps.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Comparable.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Div.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Equatable.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Mod.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Mont.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Mul.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Numeric.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256+Sub.swift create mode 100644 EllipticSwift/FixedWidthTypes/U256/U256.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Add.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Aux.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Div.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Mod.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Mul.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512+Sub.swift create mode 100644 EllipticSwift/FixedWidthTypes/U512/U512.swift create mode 100644 EllipticSwift/FixedWidthTypes/UInt32.swift create mode 100644 EllipticSwift/FixedWidthTypes/vUInt32.swift create mode 100644 EllipticSwift/Info.plist create mode 100644 EllipticSwift/WindowMethods/Constants.swift create mode 100644 EllipticSwift/WindowMethods/windowMethods.swift create mode 100644 EllipticSwiftTests/EllipticSwiftTests.swift create mode 100644 EllipticSwiftTests/Info.plist create mode 100644 EllipticSwift_iOS/EllipticSwift_iOS.h create mode 100644 EllipticSwift_iOS/Info.plist create mode 100644 LICENSE create mode 100644 Podfile create mode 100644 Podfile.lock create mode 100644 Pods/BigInt/LICENSE.md create mode 100644 Pods/BigInt/README.md create mode 100644 Pods/BigInt/sources/Addition.swift create mode 100644 Pods/BigInt/sources/BigInt.swift create mode 100644 Pods/BigInt/sources/BigUInt.swift create mode 100644 Pods/BigInt/sources/Bitwise Ops.swift create mode 100644 Pods/BigInt/sources/Codable.swift create mode 100644 Pods/BigInt/sources/Comparable.swift create mode 100644 Pods/BigInt/sources/Data Conversion.swift create mode 100644 Pods/BigInt/sources/Division.swift create mode 100644 Pods/BigInt/sources/Exponentiation.swift create mode 100644 Pods/BigInt/sources/Floating Point Conversion.swift create mode 100644 Pods/BigInt/sources/GCD.swift create mode 100644 Pods/BigInt/sources/Hashable.swift create mode 100644 Pods/BigInt/sources/Integer Conversion.swift create mode 100644 Pods/BigInt/sources/Multiplication.swift create mode 100644 Pods/BigInt/sources/Prime Test.swift create mode 100644 Pods/BigInt/sources/Random.swift create mode 100644 Pods/BigInt/sources/Shifts.swift create mode 100644 Pods/BigInt/sources/Square Root.swift create mode 100644 Pods/BigInt/sources/Strideable.swift create mode 100644 Pods/BigInt/sources/String Conversion.swift create mode 100644 Pods/BigInt/sources/Subtraction.swift create mode 100644 Pods/BigInt/sources/Words and Bits.swift create mode 100644 Pods/Manifest.lock create mode 100644 Pods/Pods.xcodeproj/project.pbxproj create mode 100644 Pods/SipHash/LICENSE.md create mode 100644 Pods/SipHash/README.md create mode 100644 Pods/SipHash/SipHash/Primitive Types.swift create mode 100644 Pods/SipHash/SipHash/RandomUInt64.swift create mode 100644 Pods/SipHash/SipHash/SipHashable.swift create mode 100644 Pods/SipHash/SipHash/SipHasher.swift create mode 100644 Pods/Target Support Files/BigInt-iOS/BigInt-iOS-dummy.m create mode 100644 Pods/Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch create mode 100644 Pods/Target Support Files/BigInt-iOS/BigInt-iOS-umbrella.h create mode 100644 Pods/Target Support Files/BigInt-iOS/BigInt-iOS.modulemap create mode 100644 Pods/Target Support Files/BigInt-iOS/BigInt-iOS.xcconfig create mode 100644 Pods/Target Support Files/BigInt-iOS/Info.plist create mode 100644 Pods/Target Support Files/BigInt-macOS/BigInt-macOS-dummy.m create mode 100644 Pods/Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch create mode 100644 Pods/Target Support Files/BigInt-macOS/BigInt-macOS-umbrella.h create mode 100644 Pods/Target Support Files/BigInt-macOS/BigInt-macOS.modulemap create mode 100644 Pods/Target Support Files/BigInt-macOS/BigInt-macOS.xcconfig create mode 100644 Pods/Target Support Files/BigInt-macOS/Info.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Info.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.markdown create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-dummy.m create mode 100755 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-resources.sh create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-umbrella.h create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.debug.xcconfig create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap create mode 100644 Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.release.xcconfig create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Info.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.markdown create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-dummy.m create mode 100755 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh create mode 100755 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-resources.sh create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-umbrella.h create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.debug.xcconfig create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap create mode 100644 Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.release.xcconfig create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Info.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.markdown create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.plist create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-dummy.m create mode 100755 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-resources.sh create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-umbrella.h create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.debug.xcconfig create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap create mode 100644 Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.release.xcconfig create mode 100644 Pods/Target Support Files/SipHash-iOS/Info.plist create mode 100644 Pods/Target Support Files/SipHash-iOS/SipHash-iOS-dummy.m create mode 100644 Pods/Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch create mode 100644 Pods/Target Support Files/SipHash-iOS/SipHash-iOS-umbrella.h create mode 100644 Pods/Target Support Files/SipHash-iOS/SipHash-iOS.modulemap create mode 100644 Pods/Target Support Files/SipHash-iOS/SipHash-iOS.xcconfig create mode 100644 Pods/Target Support Files/SipHash-macOS/Info.plist create mode 100644 Pods/Target Support Files/SipHash-macOS/SipHash-macOS-dummy.m create mode 100644 Pods/Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch create mode 100644 Pods/Target Support Files/SipHash-macOS/SipHash-macOS-umbrella.h create mode 100644 Pods/Target Support Files/SipHash-macOS/SipHash-macOS.modulemap create mode 100644 Pods/Target Support Files/SipHash-macOS/SipHash-macOS.xcconfig create mode 100644 README.md diff --git a/EllipticSwift.podspec b/EllipticSwift.podspec new file mode 100644 index 0000000..7faf630 --- /dev/null +++ b/EllipticSwift.podspec @@ -0,0 +1,26 @@ +Pod::Spec.new do |s| +s.name = "EllipticSwift" +s.version = "1.0" +s.summary = "Elliptic curve arithmetics in vanilla Swift for iOS ans macOS" + +s.description = <<-DESC +Elliptic curve arithmetics and modular multiprecision arithmetics in vanilla Swift. Uses Apple's Accelerate framework for with numeric types for now. +DESC + +s.homepage = "https://github.com/shamatar/EllipticSwift" +s.license = 'Apache License 2.0' +s.author = { "Alex Vlasov" => "alex.m.vlasov@gmail.com" } +s.source = { :git => 'https://github.com/shamatar/EllipticSwift.git', :tag => s.version.to_s } +s.social_media_url = 'https://twitter.com/shamatar' + +s.swift_version = '4.1' +s.module_name = 'EllipticSwift' +s.ios.deployment_target = "9.0" +s.osx.deployment_target = "10.11" +s.source_files = "EllipticSwift/**/*.{swift}, EllipticSwift/FixedWidthTypes/**/*.{swift}", +s.public_header_files = "EllipticSwift/**/*.{h}" +#s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + +s.frameworks = 'Accelerate' +s.dependency 'BigInt', '~> 3.1' +end diff --git a/EllipticSwift.xcodeproj/project.pbxproj b/EllipticSwift.xcodeproj/project.pbxproj new file mode 100644 index 0000000..49c387b --- /dev/null +++ b/EllipticSwift.xcodeproj/project.pbxproj @@ -0,0 +1,1032 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 4E2FF0C2B599C385794A0C81 /* Pods_EllipticSwiftTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E709830F007A5E9E18359ED /* Pods_EllipticSwiftTests.framework */; }; + 6BAAB89B98A9156B1E1E286C /* Pods_EllipticSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAD17BCD4A29B92AA5918400 /* Pods_EllipticSwift.framework */; }; + 81FECC9321199E7F006DA367 /* EllipticSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FECC8921199E7F006DA367 /* EllipticSwift.framework */; }; + 81FECC9821199E7F006DA367 /* EllipticSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECC9721199E7F006DA367 /* EllipticSwiftTests.swift */; }; + 81FECC9A21199E7F006DA367 /* EllipticSwift.h in Headers */ = {isa = PBXBuildFile; fileRef = 81FECC8C21199E7F006DA367 /* EllipticSwift.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 81FECCB821199E9D006DA367 /* EllipticSwift_iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 81FECCAA21199E9D006DA367 /* EllipticSwift_iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 81FECCC421199F6D006DA367 /* Data+Bytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC321199F6D006DA367 /* Data+Bytes.swift */; }; + 81FECCC521199F6D006DA367 /* Data+Bytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC321199F6D006DA367 /* Data+Bytes.swift */; }; + 81FECCE421199F7F006DA367 /* FiniteWidthInteger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC621199F7E006DA367 /* FiniteWidthInteger.swift */; }; + 81FECCE521199F7F006DA367 /* FiniteWidthInteger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC621199F7E006DA367 /* FiniteWidthInteger.swift */; }; + 81FECCE621199F7F006DA367 /* vUInt32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC721199F7E006DA367 /* vUInt32.swift */; }; + 81FECCE721199F7F006DA367 /* vUInt32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC721199F7E006DA367 /* vUInt32.swift */; }; + 81FECCE821199F7F006DA367 /* U512+Div.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC921199F7E006DA367 /* U512+Div.swift */; }; + 81FECCE921199F7F006DA367 /* U512+Div.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCC921199F7E006DA367 /* U512+Div.swift */; }; + 81FECCEA21199F7F006DA367 /* U512+Mul.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCA21199F7E006DA367 /* U512+Mul.swift */; }; + 81FECCEB21199F7F006DA367 /* U512+Mul.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCA21199F7E006DA367 /* U512+Mul.swift */; }; + 81FECCEC21199F7F006DA367 /* U512.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCB21199F7E006DA367 /* U512.swift */; }; + 81FECCED21199F7F006DA367 /* U512.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCB21199F7E006DA367 /* U512.swift */; }; + 81FECCEE21199F7F006DA367 /* U512+Aux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCC21199F7E006DA367 /* U512+Aux.swift */; }; + 81FECCEF21199F7F006DA367 /* U512+Aux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCC21199F7E006DA367 /* U512+Aux.swift */; }; + 81FECCF021199F7F006DA367 /* U512+Sub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCD21199F7E006DA367 /* U512+Sub.swift */; }; + 81FECCF121199F7F006DA367 /* U512+Sub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCD21199F7E006DA367 /* U512+Sub.swift */; }; + 81FECCF221199F7F006DA367 /* U512+Mod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCE21199F7E006DA367 /* U512+Mod.swift */; }; + 81FECCF321199F7F006DA367 /* U512+Mod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCE21199F7E006DA367 /* U512+Mod.swift */; }; + 81FECCF421199F7F006DA367 /* U512+Add.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCF21199F7E006DA367 /* U512+Add.swift */; }; + 81FECCF521199F7F006DA367 /* U512+Add.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCCF21199F7E006DA367 /* U512+Add.swift */; }; + 81FECCF621199F7F006DA367 /* U256+Numeric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD121199F7F006DA367 /* U256+Numeric.swift */; }; + 81FECCF721199F7F006DA367 /* U256+Numeric.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD121199F7F006DA367 /* U256+Numeric.swift */; }; + 81FECCF821199F7F006DA367 /* U256+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD221199F7F006DA367 /* U256+Comparable.swift */; }; + 81FECCF921199F7F006DA367 /* U256+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD221199F7F006DA367 /* U256+Comparable.swift */; }; + 81FECCFA21199F7F006DA367 /* U256+Mod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD321199F7F006DA367 /* U256+Mod.swift */; }; + 81FECCFB21199F7F006DA367 /* U256+Mod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD321199F7F006DA367 /* U256+Mod.swift */; }; + 81FECCFC21199F7F006DA367 /* U256+Add.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD421199F7F006DA367 /* U256+Add.swift */; }; + 81FECCFD21199F7F006DA367 /* U256+Add.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD421199F7F006DA367 /* U256+Add.swift */; }; + 81FECCFE21199F7F006DA367 /* U256+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD521199F7F006DA367 /* U256+Equatable.swift */; }; + 81FECCFF21199F7F006DA367 /* U256+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD521199F7F006DA367 /* U256+Equatable.swift */; }; + 81FECD0021199F7F006DA367 /* U256+BitOps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD621199F7F006DA367 /* U256+BitOps.swift */; }; + 81FECD0121199F7F006DA367 /* U256+BitOps.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD621199F7F006DA367 /* U256+BitOps.swift */; }; + 81FECD0221199F7F006DA367 /* U256+Sub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD721199F7F006DA367 /* U256+Sub.swift */; }; + 81FECD0321199F7F006DA367 /* U256+Sub.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD721199F7F006DA367 /* U256+Sub.swift */; }; + 81FECD0421199F7F006DA367 /* U256.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD821199F7F006DA367 /* U256.swift */; }; + 81FECD0521199F7F006DA367 /* U256.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD821199F7F006DA367 /* U256.swift */; }; + 81FECD0621199F7F006DA367 /* U256+Mont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD921199F7F006DA367 /* U256+Mont.swift */; }; + 81FECD0721199F7F006DA367 /* U256+Mont.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCD921199F7F006DA367 /* U256+Mont.swift */; }; + 81FECD0821199F7F006DA367 /* U256+Aux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDA21199F7F006DA367 /* U256+Aux.swift */; }; + 81FECD0921199F7F006DA367 /* U256+Aux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDA21199F7F006DA367 /* U256+Aux.swift */; }; + 81FECD0A21199F7F006DA367 /* U256+Div.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDB21199F7F006DA367 /* U256+Div.swift */; }; + 81FECD0B21199F7F006DA367 /* U256+Div.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDB21199F7F006DA367 /* U256+Div.swift */; }; + 81FECD0C21199F7F006DA367 /* U256+BitAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDC21199F7F006DA367 /* U256+BitAccessible.swift */; }; + 81FECD0D21199F7F006DA367 /* U256+BitAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDC21199F7F006DA367 /* U256+BitAccessible.swift */; }; + 81FECD0E21199F7F006DA367 /* U256+Mul.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDD21199F7F006DA367 /* U256+Mul.swift */; }; + 81FECD0F21199F7F006DA367 /* U256+Mul.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDD21199F7F006DA367 /* U256+Mul.swift */; }; + 81FECD1021199F7F006DA367 /* UInt32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDE21199F7F006DA367 /* UInt32.swift */; }; + 81FECD1121199F7F006DA367 /* UInt32.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCDE21199F7F006DA367 /* UInt32.swift */; }; + 81FECD1221199F7F006DA367 /* U128+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE021199F7F006DA367 /* U128+Comparable.swift */; }; + 81FECD1321199F7F006DA367 /* U128+Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE021199F7F006DA367 /* U128+Comparable.swift */; }; + 81FECD1421199F7F006DA367 /* U128+BitAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE121199F7F006DA367 /* U128+BitAccessible.swift */; }; + 81FECD1521199F7F006DA367 /* U128+BitAccessible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE121199F7F006DA367 /* U128+BitAccessible.swift */; }; + 81FECD1621199F7F006DA367 /* U128+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE221199F7F006DA367 /* U128+Equatable.swift */; }; + 81FECD1721199F7F006DA367 /* U128+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE221199F7F006DA367 /* U128+Equatable.swift */; }; + 81FECD1821199F7F006DA367 /* U128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE321199F7F006DA367 /* U128.swift */; }; + 81FECD1921199F7F006DA367 /* U128.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECCE321199F7F006DA367 /* U128.swift */; }; + 81FECD1C21199FC0006DA367 /* windowMethods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD1B21199FC0006DA367 /* windowMethods.swift */; }; + 81FECD1D21199FC0006DA367 /* windowMethods.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD1B21199FC0006DA367 /* windowMethods.swift */; }; + 81FECD1F21199FD4006DA367 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD1E21199FD4006DA367 /* Constants.swift */; }; + 81FECD2021199FD4006DA367 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD1E21199FD4006DA367 /* Constants.swift */; }; + 81FECD2421199FEB006DA367 /* CurveProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2121199FEB006DA367 /* CurveProtocols.swift */; }; + 81FECD2521199FEB006DA367 /* CurveProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2121199FEB006DA367 /* CurveProtocols.swift */; }; + 81FECD2621199FEB006DA367 /* GeneralizedPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2221199FEB006DA367 /* GeneralizedPoint.swift */; }; + 81FECD2721199FEB006DA367 /* GeneralizedPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2221199FEB006DA367 /* GeneralizedPoint.swift */; }; + 81FECD2821199FEB006DA367 /* GeneralizedWeirstrassCurve.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2321199FEB006DA367 /* GeneralizedWeirstrassCurve.swift */; }; + 81FECD2921199FEB006DA367 /* GeneralizedWeirstrassCurve.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2321199FEB006DA367 /* GeneralizedWeirstrassCurve.swift */; }; + 81FECD2C21199FF3006DA367 /* AffineCoordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2A21199FF3006DA367 /* AffineCoordinates.swift */; }; + 81FECD2D21199FF3006DA367 /* AffineCoordinates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2A21199FF3006DA367 /* AffineCoordinates.swift */; }; + 81FECD2E21199FF3006DA367 /* PrecompiledCurves.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2B21199FF3006DA367 /* PrecompiledCurves.swift */; }; + 81FECD2F21199FF3006DA367 /* PrecompiledCurves.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD2B21199FF3006DA367 /* PrecompiledCurves.swift */; }; + 81FECD342119A00F006DA367 /* GeneralizedPrimeFieldElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD302119A00F006DA367 /* GeneralizedPrimeFieldElement.swift */; }; + 81FECD352119A00F006DA367 /* GeneralizedPrimeFieldElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD302119A00F006DA367 /* GeneralizedPrimeFieldElement.swift */; }; + 81FECD362119A00F006DA367 /* FieldProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD312119A00F006DA367 /* FieldProtocols.swift */; }; + 81FECD372119A00F006DA367 /* FieldProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD312119A00F006DA367 /* FieldProtocols.swift */; }; + 81FECD382119A00F006DA367 /* GeneralizedMontPrimeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD322119A00F006DA367 /* GeneralizedMontPrimeField.swift */; }; + 81FECD392119A00F006DA367 /* GeneralizedMontPrimeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD322119A00F006DA367 /* GeneralizedMontPrimeField.swift */; }; + 81FECD3A2119A00F006DA367 /* GeneralizedNaivePrimeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD332119A00F006DA367 /* GeneralizedNaivePrimeField.swift */; }; + 81FECD3B2119A00F006DA367 /* GeneralizedNaivePrimeField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81FECD332119A00F006DA367 /* GeneralizedNaivePrimeField.swift */; }; + 81FECD3D2119A58C006DA367 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FECD3C2119A58C006DA367 /* Accelerate.framework */; }; + 81FECD3F2119A595006DA367 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81FECD3E2119A595006DA367 /* Accelerate.framework */; }; + E61235C0E4EF4E6E643D0DF1 /* Pods_EllipticSwift_iOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FCDD2EFBC3D235EAD99760C1 /* Pods_EllipticSwift_iOS.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 81FECC9421199E7F006DA367 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 81FECC8021199E7F006DA367 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 81FECC8821199E7F006DA367; + remoteInfo = EllipticSwift; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 16FE95B600F9F6F2285A807A /* Pods-EllipticSwiftTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwiftTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.debug.xcconfig"; sourceTree = ""; }; + 4E709830F007A5E9E18359ED /* Pods_EllipticSwiftTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwiftTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 530CBA30217657F36D86BAF2 /* Pods-EllipticSwift_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwift_iOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.debug.xcconfig"; sourceTree = ""; }; + 661AA4D620A4CE827F38D64D /* Pods-EllipticSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwift.release.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.release.xcconfig"; sourceTree = ""; }; + 7A745B1E694492557E6ED056 /* Pods-EllipticSwift_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwift_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.release.xcconfig"; sourceTree = ""; }; + 81FECC8921199E7F006DA367 /* EllipticSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EllipticSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 81FECC8C21199E7F006DA367 /* EllipticSwift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EllipticSwift.h; sourceTree = ""; }; + 81FECC8D21199E7F006DA367 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 81FECC9221199E7F006DA367 /* EllipticSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EllipticSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 81FECC9721199E7F006DA367 /* EllipticSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EllipticSwiftTests.swift; sourceTree = ""; }; + 81FECC9921199E7F006DA367 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 81FECCA821199E9D006DA367 /* EllipticSwift_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EllipticSwift_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 81FECCAA21199E9D006DA367 /* EllipticSwift_iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EllipticSwift_iOS.h; sourceTree = ""; }; + 81FECCAB21199E9D006DA367 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 81FECCC321199F6D006DA367 /* Data+Bytes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Data+Bytes.swift"; sourceTree = ""; }; + 81FECCC621199F7E006DA367 /* FiniteWidthInteger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FiniteWidthInteger.swift; sourceTree = ""; }; + 81FECCC721199F7E006DA367 /* vUInt32.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = vUInt32.swift; sourceTree = ""; }; + 81FECCC921199F7E006DA367 /* U512+Div.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Div.swift"; sourceTree = ""; }; + 81FECCCA21199F7E006DA367 /* U512+Mul.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Mul.swift"; sourceTree = ""; }; + 81FECCCB21199F7E006DA367 /* U512.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = U512.swift; sourceTree = ""; }; + 81FECCCC21199F7E006DA367 /* U512+Aux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Aux.swift"; sourceTree = ""; }; + 81FECCCD21199F7E006DA367 /* U512+Sub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Sub.swift"; sourceTree = ""; }; + 81FECCCE21199F7E006DA367 /* U512+Mod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Mod.swift"; sourceTree = ""; }; + 81FECCCF21199F7E006DA367 /* U512+Add.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U512+Add.swift"; sourceTree = ""; }; + 81FECCD121199F7F006DA367 /* U256+Numeric.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Numeric.swift"; sourceTree = ""; }; + 81FECCD221199F7F006DA367 /* U256+Comparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Comparable.swift"; sourceTree = ""; }; + 81FECCD321199F7F006DA367 /* U256+Mod.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Mod.swift"; sourceTree = ""; }; + 81FECCD421199F7F006DA367 /* U256+Add.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Add.swift"; sourceTree = ""; }; + 81FECCD521199F7F006DA367 /* U256+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Equatable.swift"; sourceTree = ""; }; + 81FECCD621199F7F006DA367 /* U256+BitOps.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+BitOps.swift"; sourceTree = ""; }; + 81FECCD721199F7F006DA367 /* U256+Sub.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Sub.swift"; sourceTree = ""; }; + 81FECCD821199F7F006DA367 /* U256.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = U256.swift; sourceTree = ""; }; + 81FECCD921199F7F006DA367 /* U256+Mont.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Mont.swift"; sourceTree = ""; }; + 81FECCDA21199F7F006DA367 /* U256+Aux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Aux.swift"; sourceTree = ""; }; + 81FECCDB21199F7F006DA367 /* U256+Div.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Div.swift"; sourceTree = ""; }; + 81FECCDC21199F7F006DA367 /* U256+BitAccessible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+BitAccessible.swift"; sourceTree = ""; }; + 81FECCDD21199F7F006DA367 /* U256+Mul.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U256+Mul.swift"; sourceTree = ""; }; + 81FECCDE21199F7F006DA367 /* UInt32.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UInt32.swift; sourceTree = ""; }; + 81FECCE021199F7F006DA367 /* U128+Comparable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U128+Comparable.swift"; sourceTree = ""; }; + 81FECCE121199F7F006DA367 /* U128+BitAccessible.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U128+BitAccessible.swift"; sourceTree = ""; }; + 81FECCE221199F7F006DA367 /* U128+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "U128+Equatable.swift"; sourceTree = ""; }; + 81FECCE321199F7F006DA367 /* U128.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = U128.swift; sourceTree = ""; }; + 81FECD1B21199FC0006DA367 /* windowMethods.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = windowMethods.swift; sourceTree = ""; }; + 81FECD1E21199FD4006DA367 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; + 81FECD2121199FEB006DA367 /* CurveProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurveProtocols.swift; sourceTree = ""; }; + 81FECD2221199FEB006DA367 /* GeneralizedPoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralizedPoint.swift; sourceTree = ""; }; + 81FECD2321199FEB006DA367 /* GeneralizedWeirstrassCurve.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralizedWeirstrassCurve.swift; sourceTree = ""; }; + 81FECD2A21199FF3006DA367 /* AffineCoordinates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AffineCoordinates.swift; sourceTree = ""; }; + 81FECD2B21199FF3006DA367 /* PrecompiledCurves.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrecompiledCurves.swift; sourceTree = ""; }; + 81FECD302119A00F006DA367 /* GeneralizedPrimeFieldElement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralizedPrimeFieldElement.swift; sourceTree = ""; }; + 81FECD312119A00F006DA367 /* FieldProtocols.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FieldProtocols.swift; sourceTree = ""; }; + 81FECD322119A00F006DA367 /* GeneralizedMontPrimeField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralizedMontPrimeField.swift; sourceTree = ""; }; + 81FECD332119A00F006DA367 /* GeneralizedNaivePrimeField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralizedNaivePrimeField.swift; sourceTree = ""; }; + 81FECD3C2119A58C006DA367 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + 81FECD3E2119A595006DA367 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; + AC4D1189620EF53ECB615719 /* Pods-EllipticSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.debug.xcconfig"; sourceTree = ""; }; + F43923C9E7BF0A1C243CFE36 /* Pods-EllipticSwiftTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EllipticSwiftTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.release.xcconfig"; sourceTree = ""; }; + FAD17BCD4A29B92AA5918400 /* Pods_EllipticSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FCDD2EFBC3D235EAD99760C1 /* Pods_EllipticSwift_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwift_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 81FECC8521199E7F006DA367 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECD3D2119A58C006DA367 /* Accelerate.framework in Frameworks */, + 6BAAB89B98A9156B1E1E286C /* Pods_EllipticSwift.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECC8F21199E7F006DA367 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECC9321199E7F006DA367 /* EllipticSwift.framework in Frameworks */, + 4E2FF0C2B599C385794A0C81 /* Pods_EllipticSwiftTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECCA421199E9D006DA367 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECD3F2119A595006DA367 /* Accelerate.framework in Frameworks */, + E61235C0E4EF4E6E643D0DF1 /* Pods_EllipticSwift_iOS.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3089384FE7740E35C3B38DE0 /* Pods */ = { + isa = PBXGroup; + children = ( + AC4D1189620EF53ECB615719 /* Pods-EllipticSwift.debug.xcconfig */, + 661AA4D620A4CE827F38D64D /* Pods-EllipticSwift.release.xcconfig */, + 16FE95B600F9F6F2285A807A /* Pods-EllipticSwiftTests.debug.xcconfig */, + F43923C9E7BF0A1C243CFE36 /* Pods-EllipticSwiftTests.release.xcconfig */, + 530CBA30217657F36D86BAF2 /* Pods-EllipticSwift_iOS.debug.xcconfig */, + 7A745B1E694492557E6ED056 /* Pods-EllipticSwift_iOS.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 437BE2BACCB71EBDB03FF2AC /* Frameworks */ = { + isa = PBXGroup; + children = ( + 81FECD3C2119A58C006DA367 /* Accelerate.framework */, + 81FECD3E2119A595006DA367 /* Accelerate.framework */, + FAD17BCD4A29B92AA5918400 /* Pods_EllipticSwift.framework */, + 4E709830F007A5E9E18359ED /* Pods_EllipticSwiftTests.framework */, + FCDD2EFBC3D235EAD99760C1 /* Pods_EllipticSwift_iOS.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 81FECC7F21199E7F006DA367 = { + isa = PBXGroup; + children = ( + 81FECC8B21199E7F006DA367 /* EllipticSwift */, + 81FECC9621199E7F006DA367 /* EllipticSwiftTests */, + 81FECCA921199E9D006DA367 /* EllipticSwift_iOS */, + 81FECC8A21199E7F006DA367 /* Products */, + 3089384FE7740E35C3B38DE0 /* Pods */, + 437BE2BACCB71EBDB03FF2AC /* Frameworks */, + ); + sourceTree = ""; + }; + 81FECC8A21199E7F006DA367 /* Products */ = { + isa = PBXGroup; + children = ( + 81FECC8921199E7F006DA367 /* EllipticSwift.framework */, + 81FECC9221199E7F006DA367 /* EllipticSwiftTests.xctest */, + 81FECCA821199E9D006DA367 /* EllipticSwift_iOS.framework */, + ); + name = Products; + sourceTree = ""; + }; + 81FECC8B21199E7F006DA367 /* EllipticSwift */ = { + isa = PBXGroup; + children = ( + 81FECD1A21199FB3006DA367 /* WindowMethods */, + 81FECCC221199F5D006DA367 /* Extensions */, + 81FECCC121199F4C006DA367 /* FixedWidthTypes */, + 81FECCC021199F43006DA367 /* Field */, + 81FECCBF21199F3A006DA367 /* Curve */, + 81FECC8C21199E7F006DA367 /* EllipticSwift.h */, + 81FECC8D21199E7F006DA367 /* Info.plist */, + ); + path = EllipticSwift; + sourceTree = ""; + }; + 81FECC9621199E7F006DA367 /* EllipticSwiftTests */ = { + isa = PBXGroup; + children = ( + 81FECC9721199E7F006DA367 /* EllipticSwiftTests.swift */, + 81FECC9921199E7F006DA367 /* Info.plist */, + ); + path = EllipticSwiftTests; + sourceTree = ""; + }; + 81FECCA921199E9D006DA367 /* EllipticSwift_iOS */ = { + isa = PBXGroup; + children = ( + 81FECCAA21199E9D006DA367 /* EllipticSwift_iOS.h */, + 81FECCAB21199E9D006DA367 /* Info.plist */, + ); + path = EllipticSwift_iOS; + sourceTree = ""; + }; + 81FECCBF21199F3A006DA367 /* Curve */ = { + isa = PBXGroup; + children = ( + 81FECD2A21199FF3006DA367 /* AffineCoordinates.swift */, + 81FECD2B21199FF3006DA367 /* PrecompiledCurves.swift */, + 81FECD2121199FEB006DA367 /* CurveProtocols.swift */, + 81FECD2221199FEB006DA367 /* GeneralizedPoint.swift */, + 81FECD2321199FEB006DA367 /* GeneralizedWeirstrassCurve.swift */, + ); + path = Curve; + sourceTree = ""; + }; + 81FECCC021199F43006DA367 /* Field */ = { + isa = PBXGroup; + children = ( + 81FECD312119A00F006DA367 /* FieldProtocols.swift */, + 81FECD322119A00F006DA367 /* GeneralizedMontPrimeField.swift */, + 81FECD332119A00F006DA367 /* GeneralizedNaivePrimeField.swift */, + 81FECD302119A00F006DA367 /* GeneralizedPrimeFieldElement.swift */, + ); + path = Field; + sourceTree = ""; + }; + 81FECCC121199F4C006DA367 /* FixedWidthTypes */ = { + isa = PBXGroup; + children = ( + 81FECCDE21199F7F006DA367 /* UInt32.swift */, + 81FECCC721199F7E006DA367 /* vUInt32.swift */, + 81FECCC621199F7E006DA367 /* FiniteWidthInteger.swift */, + 81FECCDF21199F7F006DA367 /* U128 */, + 81FECCD021199F7F006DA367 /* U256 */, + 81FECCC821199F7E006DA367 /* U512 */, + ); + path = FixedWidthTypes; + sourceTree = ""; + }; + 81FECCC221199F5D006DA367 /* Extensions */ = { + isa = PBXGroup; + children = ( + 81FECCC321199F6D006DA367 /* Data+Bytes.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + 81FECCC821199F7E006DA367 /* U512 */ = { + isa = PBXGroup; + children = ( + 81FECCC921199F7E006DA367 /* U512+Div.swift */, + 81FECCCA21199F7E006DA367 /* U512+Mul.swift */, + 81FECCCB21199F7E006DA367 /* U512.swift */, + 81FECCCC21199F7E006DA367 /* U512+Aux.swift */, + 81FECCCD21199F7E006DA367 /* U512+Sub.swift */, + 81FECCCE21199F7E006DA367 /* U512+Mod.swift */, + 81FECCCF21199F7E006DA367 /* U512+Add.swift */, + ); + path = U512; + sourceTree = ""; + }; + 81FECCD021199F7F006DA367 /* U256 */ = { + isa = PBXGroup; + children = ( + 81FECCD121199F7F006DA367 /* U256+Numeric.swift */, + 81FECCD221199F7F006DA367 /* U256+Comparable.swift */, + 81FECCD321199F7F006DA367 /* U256+Mod.swift */, + 81FECCD421199F7F006DA367 /* U256+Add.swift */, + 81FECCD521199F7F006DA367 /* U256+Equatable.swift */, + 81FECCD621199F7F006DA367 /* U256+BitOps.swift */, + 81FECCD721199F7F006DA367 /* U256+Sub.swift */, + 81FECCD821199F7F006DA367 /* U256.swift */, + 81FECCD921199F7F006DA367 /* U256+Mont.swift */, + 81FECCDA21199F7F006DA367 /* U256+Aux.swift */, + 81FECCDB21199F7F006DA367 /* U256+Div.swift */, + 81FECCDC21199F7F006DA367 /* U256+BitAccessible.swift */, + 81FECCDD21199F7F006DA367 /* U256+Mul.swift */, + ); + path = U256; + sourceTree = ""; + }; + 81FECCDF21199F7F006DA367 /* U128 */ = { + isa = PBXGroup; + children = ( + 81FECCE021199F7F006DA367 /* U128+Comparable.swift */, + 81FECCE121199F7F006DA367 /* U128+BitAccessible.swift */, + 81FECCE221199F7F006DA367 /* U128+Equatable.swift */, + 81FECCE321199F7F006DA367 /* U128.swift */, + ); + path = U128; + sourceTree = ""; + }; + 81FECD1A21199FB3006DA367 /* WindowMethods */ = { + isa = PBXGroup; + children = ( + 81FECD1B21199FC0006DA367 /* windowMethods.swift */, + 81FECD1E21199FD4006DA367 /* Constants.swift */, + ); + path = WindowMethods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 81FECC8621199E7F006DA367 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECC9A21199E7F006DA367 /* EllipticSwift.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECCA521199E9D006DA367 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECCB821199E9D006DA367 /* EllipticSwift_iOS.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 81FECC8821199E7F006DA367 /* EllipticSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 81FECC9D21199E7F006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwift" */; + buildPhases = ( + A77B04C0999CD17197398B21 /* [CP] Check Pods Manifest.lock */, + 81FECC8421199E7F006DA367 /* Sources */, + 81FECC8521199E7F006DA367 /* Frameworks */, + 81FECC8621199E7F006DA367 /* Headers */, + 81FECC8721199E7F006DA367 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = EllipticSwift; + productName = EllipticSwift; + productReference = 81FECC8921199E7F006DA367 /* EllipticSwift.framework */; + productType = "com.apple.product-type.framework"; + }; + 81FECC9121199E7F006DA367 /* EllipticSwiftTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 81FECCA021199E7F006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwiftTests" */; + buildPhases = ( + 2B50E0569DE50A94750352FD /* [CP] Check Pods Manifest.lock */, + 81FECC8E21199E7F006DA367 /* Sources */, + 81FECC8F21199E7F006DA367 /* Frameworks */, + 81FECC9021199E7F006DA367 /* Resources */, + 644E9C4920E68B2747CB45E0 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 81FECC9521199E7F006DA367 /* PBXTargetDependency */, + ); + name = EllipticSwiftTests; + productName = EllipticSwiftTests; + productReference = 81FECC9221199E7F006DA367 /* EllipticSwiftTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 81FECCA721199E9D006DA367 /* EllipticSwift_iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 81FECCB921199E9D006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwift_iOS" */; + buildPhases = ( + 2A09BC38832ADBC571E4B178 /* [CP] Check Pods Manifest.lock */, + 81FECCA321199E9D006DA367 /* Sources */, + 81FECCA421199E9D006DA367 /* Frameworks */, + 81FECCA521199E9D006DA367 /* Headers */, + 81FECCA621199E9D006DA367 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = EllipticSwift_iOS; + productName = EllipticSwift_iOS; + productReference = 81FECCA821199E9D006DA367 /* EllipticSwift_iOS.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 81FECC8021199E7F006DA367 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0940; + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = "Alexander Vlasov"; + TargetAttributes = { + 81FECC8821199E7F006DA367 = { + CreatedOnToolsVersion = 9.4.1; + LastSwiftMigration = 0940; + }; + 81FECC9121199E7F006DA367 = { + CreatedOnToolsVersion = 9.4.1; + }; + 81FECCA721199E9D006DA367 = { + CreatedOnToolsVersion = 9.4.1; + LastSwiftMigration = 0940; + }; + }; + }; + buildConfigurationList = 81FECC8321199E7F006DA367 /* Build configuration list for PBXProject "EllipticSwift" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 81FECC7F21199E7F006DA367; + productRefGroup = 81FECC8A21199E7F006DA367 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 81FECC8821199E7F006DA367 /* EllipticSwift */, + 81FECC9121199E7F006DA367 /* EllipticSwiftTests */, + 81FECCA721199E9D006DA367 /* EllipticSwift_iOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 81FECC8721199E7F006DA367 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECC9021199E7F006DA367 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECCA621199E9D006DA367 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 2A09BC38832ADBC571E4B178 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-EllipticSwift_iOS-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 2B50E0569DE50A94750352FD /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-EllipticSwiftTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + 644E9C4920E68B2747CB45E0 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/BigInt-macOS/BigInt.framework", + "${BUILT_PRODUCTS_DIR}/SipHash-macOS/SipHash.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BigInt.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SipHash.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + A77B04C0999CD17197398B21 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-EllipticSwift-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 81FECC8421199E7F006DA367 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECCF421199F7F006DA367 /* U512+Add.swift in Sources */, + 81FECD1621199F7F006DA367 /* U128+Equatable.swift in Sources */, + 81FECD0C21199F7F006DA367 /* U256+BitAccessible.swift in Sources */, + 81FECD0621199F7F006DA367 /* U256+Mont.swift in Sources */, + 81FECD1421199F7F006DA367 /* U128+BitAccessible.swift in Sources */, + 81FECD2621199FEB006DA367 /* GeneralizedPoint.swift in Sources */, + 81FECD1F21199FD4006DA367 /* Constants.swift in Sources */, + 81FECCEC21199F7F006DA367 /* U512.swift in Sources */, + 81FECCF621199F7F006DA367 /* U256+Numeric.swift in Sources */, + 81FECCFE21199F7F006DA367 /* U256+Equatable.swift in Sources */, + 81FECCE821199F7F006DA367 /* U512+Div.swift in Sources */, + 81FECCEE21199F7F006DA367 /* U512+Aux.swift in Sources */, + 81FECCF021199F7F006DA367 /* U512+Sub.swift in Sources */, + 81FECD0E21199F7F006DA367 /* U256+Mul.swift in Sources */, + 81FECD0A21199F7F006DA367 /* U256+Div.swift in Sources */, + 81FECCFA21199F7F006DA367 /* U256+Mod.swift in Sources */, + 81FECD1C21199FC0006DA367 /* windowMethods.swift in Sources */, + 81FECD1021199F7F006DA367 /* UInt32.swift in Sources */, + 81FECCE421199F7F006DA367 /* FiniteWidthInteger.swift in Sources */, + 81FECCF821199F7F006DA367 /* U256+Comparable.swift in Sources */, + 81FECD0021199F7F006DA367 /* U256+BitOps.swift in Sources */, + 81FECD3A2119A00F006DA367 /* GeneralizedNaivePrimeField.swift in Sources */, + 81FECD362119A00F006DA367 /* FieldProtocols.swift in Sources */, + 81FECCF221199F7F006DA367 /* U512+Mod.swift in Sources */, + 81FECCE621199F7F006DA367 /* vUInt32.swift in Sources */, + 81FECD0421199F7F006DA367 /* U256.swift in Sources */, + 81FECD2C21199FF3006DA367 /* AffineCoordinates.swift in Sources */, + 81FECD2421199FEB006DA367 /* CurveProtocols.swift in Sources */, + 81FECCC421199F6D006DA367 /* Data+Bytes.swift in Sources */, + 81FECD0821199F7F006DA367 /* U256+Aux.swift in Sources */, + 81FECCEA21199F7F006DA367 /* U512+Mul.swift in Sources */, + 81FECD1221199F7F006DA367 /* U128+Comparable.swift in Sources */, + 81FECD2821199FEB006DA367 /* GeneralizedWeirstrassCurve.swift in Sources */, + 81FECD1821199F7F006DA367 /* U128.swift in Sources */, + 81FECD0221199F7F006DA367 /* U256+Sub.swift in Sources */, + 81FECD2E21199FF3006DA367 /* PrecompiledCurves.swift in Sources */, + 81FECD342119A00F006DA367 /* GeneralizedPrimeFieldElement.swift in Sources */, + 81FECCFC21199F7F006DA367 /* U256+Add.swift in Sources */, + 81FECD382119A00F006DA367 /* GeneralizedMontPrimeField.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECC8E21199E7F006DA367 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECC9821199E7F006DA367 /* EllipticSwiftTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 81FECCA321199E9D006DA367 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 81FECCF521199F7F006DA367 /* U512+Add.swift in Sources */, + 81FECD1721199F7F006DA367 /* U128+Equatable.swift in Sources */, + 81FECD0D21199F7F006DA367 /* U256+BitAccessible.swift in Sources */, + 81FECD0721199F7F006DA367 /* U256+Mont.swift in Sources */, + 81FECD1521199F7F006DA367 /* U128+BitAccessible.swift in Sources */, + 81FECD2721199FEB006DA367 /* GeneralizedPoint.swift in Sources */, + 81FECD2021199FD4006DA367 /* Constants.swift in Sources */, + 81FECCED21199F7F006DA367 /* U512.swift in Sources */, + 81FECCF721199F7F006DA367 /* U256+Numeric.swift in Sources */, + 81FECCFF21199F7F006DA367 /* U256+Equatable.swift in Sources */, + 81FECCE921199F7F006DA367 /* U512+Div.swift in Sources */, + 81FECCEF21199F7F006DA367 /* U512+Aux.swift in Sources */, + 81FECCF121199F7F006DA367 /* U512+Sub.swift in Sources */, + 81FECD0F21199F7F006DA367 /* U256+Mul.swift in Sources */, + 81FECD0B21199F7F006DA367 /* U256+Div.swift in Sources */, + 81FECCFB21199F7F006DA367 /* U256+Mod.swift in Sources */, + 81FECD1D21199FC0006DA367 /* windowMethods.swift in Sources */, + 81FECD1121199F7F006DA367 /* UInt32.swift in Sources */, + 81FECCE521199F7F006DA367 /* FiniteWidthInteger.swift in Sources */, + 81FECCF921199F7F006DA367 /* U256+Comparable.swift in Sources */, + 81FECD0121199F7F006DA367 /* U256+BitOps.swift in Sources */, + 81FECD3B2119A00F006DA367 /* GeneralizedNaivePrimeField.swift in Sources */, + 81FECD372119A00F006DA367 /* FieldProtocols.swift in Sources */, + 81FECCF321199F7F006DA367 /* U512+Mod.swift in Sources */, + 81FECCE721199F7F006DA367 /* vUInt32.swift in Sources */, + 81FECD0521199F7F006DA367 /* U256.swift in Sources */, + 81FECD2D21199FF3006DA367 /* AffineCoordinates.swift in Sources */, + 81FECD2521199FEB006DA367 /* CurveProtocols.swift in Sources */, + 81FECCC521199F6D006DA367 /* Data+Bytes.swift in Sources */, + 81FECD0921199F7F006DA367 /* U256+Aux.swift in Sources */, + 81FECCEB21199F7F006DA367 /* U512+Mul.swift in Sources */, + 81FECD1321199F7F006DA367 /* U128+Comparable.swift in Sources */, + 81FECD2921199FEB006DA367 /* GeneralizedWeirstrassCurve.swift in Sources */, + 81FECD1921199F7F006DA367 /* U128.swift in Sources */, + 81FECD0321199F7F006DA367 /* U256+Sub.swift in Sources */, + 81FECD2F21199FF3006DA367 /* PrecompiledCurves.swift in Sources */, + 81FECD352119A00F006DA367 /* GeneralizedPrimeFieldElement.swift in Sources */, + 81FECCFD21199F7F006DA367 /* U256+Add.swift in Sources */, + 81FECD392119A00F006DA367 /* GeneralizedMontPrimeField.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 81FECC9521199E7F006DA367 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 81FECC8821199E7F006DA367 /* EllipticSwift */; + targetProxy = 81FECC9421199E7F006DA367 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 81FECC9B21199E7F006DA367 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + 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.13; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 81FECC9C21199E7F006DA367 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac 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 = gnu11; + 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; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 81FECC9E21199E7F006DA367 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = AC4D1189620EF53ECB615719 /* Pods-EllipticSwift.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = EllipticSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.shamatar.EllipticSwift; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 81FECC9F21199E7F006DA367 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 661AA4D620A4CE827F38D64D /* Pods-EllipticSwift.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = EllipticSwift/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.shamatar.EllipticSwift; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; + 81FECCA121199E7F006DA367 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 16FE95B600F9F6F2285A807A /* Pods-EllipticSwiftTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + INFOPLIST_FILE = EllipticSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.shamatar.EllipticSwiftTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + 81FECCA221199E7F006DA367 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F43923C9E7BF0A1C243CFE36 /* Pods-EllipticSwiftTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + INFOPLIST_FILE = EllipticSwiftTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + "@loader_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = org.shamatar.EllipticSwiftTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; + 81FECCBA21199E9D006DA367 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 530CBA30217657F36D86BAF2 /* Pods-EllipticSwift_iOS.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = EllipticSwift_iOS/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.shamatar.EllipticSwift-iOS"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 81FECCBB21199E9D006DA367 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7A745B1E694492557E6ED056 /* Pods-EllipticSwift_iOS.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = 62V9CKQN89; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = EllipticSwift_iOS/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "org.shamatar.EllipticSwift-iOS"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 81FECC8321199E7F006DA367 /* Build configuration list for PBXProject "EllipticSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 81FECC9B21199E7F006DA367 /* Debug */, + 81FECC9C21199E7F006DA367 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 81FECC9D21199E7F006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 81FECC9E21199E7F006DA367 /* Debug */, + 81FECC9F21199E7F006DA367 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 81FECCA021199E7F006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwiftTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 81FECCA121199E7F006DA367 /* Debug */, + 81FECCA221199E7F006DA367 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 81FECCB921199E9D006DA367 /* Build configuration list for PBXNativeTarget "EllipticSwift_iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 81FECCBA21199E9D006DA367 /* Debug */, + 81FECCBB21199E9D006DA367 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 81FECC8021199E7F006DA367 /* Project object */; +} diff --git a/EllipticSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/EllipticSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..b9d127e --- /dev/null +++ b/EllipticSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/EllipticSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EllipticSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EllipticSwift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EllipticSwift.xcworkspace/contents.xcworkspacedata b/EllipticSwift.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..6c5ada6 --- /dev/null +++ b/EllipticSwift.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/EllipticSwift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/EllipticSwift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/EllipticSwift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/EllipticSwift/Curve/AffineCoordinates.swift b/EllipticSwift/Curve/AffineCoordinates.swift new file mode 100644 index 0000000..04eba75 --- /dev/null +++ b/EllipticSwift/Curve/AffineCoordinates.swift @@ -0,0 +1,31 @@ +// +// AffineCoordinates.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 10.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public struct AffineCoordinates: CustomStringConvertible { + public var description: String { + if self.isInfinity { + return "Point of O" + } else { + return "Point " + "(0x" + String(self.X, radix: 16) + ", 0x" + String(self.Y, radix: 16) + ")" + } + } + + public var isInfinity: Bool = false + public var X: BigUInt + public var Y: BigUInt + public init(_ x: BigUInt, _ y: BigUInt) { + self.X = x + self.Y = y + } + internal mutating func setInfinity() { + self.isInfinity = true + } +} diff --git a/EllipticSwift/Curve/CurveProtocols.swift b/EllipticSwift/Curve/CurveProtocols.swift new file mode 100644 index 0000000..bb612d9 --- /dev/null +++ b/EllipticSwift/Curve/CurveProtocols.swift @@ -0,0 +1,75 @@ +// +// CurveProtocol.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public protocol CurveProtocol { + associatedtype Field + associatedtype FieldElement: PrimeFieldElementProtocol where FieldElement.Field == Field +// associatedtype ScalarElement: FieldBound + + associatedtype AffineType: AffinePointProtocol + associatedtype ProjectiveType: ProjectivePointProtocol + + var field: Field {get} + var order: Field.UnderlyingRawType {get} + var curveOrderField: Field {get} +// var generator: AffineType? {get} + + func checkOnCurve(_ p: AffineType) -> Bool + func add(_ p: ProjectiveType, _ q: ProjectiveType) -> ProjectiveType + func sub(_ p: ProjectiveType, _ q: ProjectiveType) -> ProjectiveType + func mixedAdd(_ p: ProjectiveType, _ q: AffineType) -> ProjectiveType +// func mul(_ scalar: BigNumber, _ p: AffineType) -> ProjectiveType +// func mul(_ scalar: BigUInt, _ p: AffineType) -> ProjectiveType +// func mul(_ scalar: GeneralizedPrimeFieldElement, _ p: AffineType) -> ProjectiveType +// func mul(_ scalar: BytesRepresentable, _ p: AffineType) -> ProjectiveType + func mul(_ scalar: Field.UnderlyingRawType, _ p: AffineType) -> ProjectiveType + func neg(_ p: ProjectiveType) -> ProjectiveType + func hashInto(_ data: Data) -> AffineType + func testGenerator(_ p: AffineCoordinates) -> Bool +} + +public protocol AffinePointProtocol { + associatedtype Curve: CurveProtocol + associatedtype ProjectiveType: ProjectivePointProtocol where ProjectiveType.Curve == Curve + var curve: Curve {get} + var isInfinity: Bool {get} + var rawX: Curve.FieldElement {get} + var rawY: Curve.FieldElement {get} + var X: Curve.Field.UnderlyingRawType {get} + var Y: Curve.Field.UnderlyingRawType {get} + + var coordinates: AffineCoordinates {get} + + func isEqualTo(_ other: Self) -> Bool + + init(_ rawX: Curve.FieldElement, _ rawY: Curve.FieldElement, _ curve: Curve) + + func toProjective() -> ProjectiveType +} + +public protocol ProjectivePointProtocol { + associatedtype Curve + associatedtype AffineType: AffinePointProtocol where AffineType.Curve == Curve + var curve: Curve {get} + + var isInfinity: Bool {get} + var rawX: Curve.FieldElement {get} + var rawY: Curve.FieldElement {get} + var rawZ: Curve.FieldElement {get} + + static func infinityPoint(_ curve: Curve) -> Self + + func isEqualTo(_ other: Self) -> Bool + + init(_ rawX: Curve.FieldElement, _ rawY: Curve.FieldElement, _ rawZ: Curve.FieldElement, _ curve: Curve) + + func toAffine() -> AffineType +} diff --git a/EllipticSwift/Curve/GeneralizedPoint.swift b/EllipticSwift/Curve/GeneralizedPoint.swift new file mode 100644 index 0000000..7c247a1 --- /dev/null +++ b/EllipticSwift/Curve/GeneralizedPoint.swift @@ -0,0 +1,149 @@ +// +// GeneralizedPoint.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 03.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public struct GeneralizedAffinePoint: AffinePointProtocol where T: CurveProtocol { + public typealias ProjectiveType = GeneralizedProjectivePoint + public typealias Curve = T + public typealias FE = T.FieldElement + public typealias UnderlyingRawType = T.Field.UnderlyingRawType + + public var description: String { + return self.coordinates.description + } + + public var curve: Curve + public var isInfinity: Bool = true + public var rawX: FE + public var rawY: FE + public var X: UnderlyingRawType { + return self.rawX.nativeValue + } + public var Y: UnderlyingRawType { + return self.rawY.nativeValue + } + + public var coordinates: AffineCoordinates { + if !self.isInfinity { + return AffineCoordinates(BigUInt(self.X.bytes), BigUInt(self.Y.bytes)) + } else { + var p = AffineCoordinates(0, 0) + p.setInfinity() + return p + } + } + + public init(_ rawX: FE, _ rawY: FE, _ curve: Curve) { + self.rawX = rawX + self.rawY = rawY + self.curve = curve + self.isInfinity = false + } + + public func toProjective() -> ProjectiveType { + if self.isInfinity { + return ProjectiveType.infinityPoint(self.curve) + } + let field = self.curve.field + let one = FE.identityElement(field) + let p = ProjectiveType(self.rawX, self.rawY, one, curve) + return p + } + + public func isEqualTo(_ other: GeneralizedAffinePoint) -> Bool { + return self.rawX == other.rawX && self.rawY == other.rawY + } + + public static func == (lhs: GeneralizedAffinePoint, rhs: GeneralizedAffinePoint) -> Bool { + return lhs.isEqualTo(rhs) + } + +// public static func * (lhs: U, rhs: GeneralizedAffinePoint) -> ProjectiveType where U: FiniteFieldCompatible { +// return rhs.curve.mul(lhs, rhs) +// } +// +// public static func + (lhs: T.AffineType, rhs: T.AffineType) -> ProjectiveType { +// return lhs.curve.mixedAdd(lhs.toProjective(), rhs) +// } +} + +public struct GeneralizedProjectivePoint: ProjectivePointProtocol where T: CurveProtocol { + // also refered as Jacobian Point + public typealias AffineType = GeneralizedAffinePoint + public typealias Curve = T + public typealias FE = T.FieldElement + public typealias UnderlyingRawType = T.Field.UnderlyingRawType + + public var curve: Curve + + public var isInfinity: Bool { + return self.rawZ.isZero + } + public var rawX: FE + public var rawY: FE + public var rawZ: FE + + public static func infinityPoint(_ curve: U) -> GeneralizedProjectivePoint where U: CurveProtocol { + let field = curve.field + let zero = U.FieldElement.zeroElement(field) + let one = U.FieldElement.identityElement(field) + return GeneralizedProjectivePoint(zero, one, zero, curve) + } + + public func isEqualTo(_ other: GeneralizedProjectivePoint) -> Bool { + return self.toAffine().isEqualTo(other.toAffine()) + } + + public init(_ rawX: FE, _ rawY: FE, _ rawZ: FE, _ curve: Curve) { + self.rawX = rawX + self.rawY = rawY + self.rawZ = rawZ + self.curve = curve + } + + public func toAffine() -> AffineType { + if self.isInfinity { + let field = curve.field + let zero = FE.zeroElement(field) + var p = AffineType(zero, zero, self.curve) + p.isInfinity = true + return p + } + let zInv = self.rawZ.inv() + let zInv2 = zInv * zInv + let zInv3 = zInv2 * zInv + let affineX = self.rawX * zInv2 + let affineY = self.rawY * zInv3 + return AffineType(affineX, affineY, self.curve) + } + + public static func == (lhs: GeneralizedProjectivePoint, rhs: GeneralizedProjectivePoint) -> Bool { + return lhs.isEqualTo(rhs) + } + +// public static func + (lhs: GeneralizedProjectivePoint, rhs: GeneralizedProjectivePoint) -> GeneralizedProjectivePoint { +// return lhs.curve.add(lhs, rhs) +// } +// +// public static func - (lhs: GeneralizedProjectivePoint, rhs: GeneralizedProjectivePoint) -> GeneralizedProjectivePoint { +// return lhs.curve.sub(lhs, rhs) +// } +// +// public static func * (lhs: FiniteFieldCompatible, rhs: GeneralizedProjectivePoint) -> GeneralizedProjectivePoint { +// if rhs.isInfinity { +// return rhs +// } +// return rhs.curve.mul(lhs, rhs.toAffine()) +// } +// +// public static func + (lhs: GeneralizedProjectivePoint, rhs: GeneralizedAffinePoint) -> GeneralizedProjectivePoint { +// return lhs.curve.mixedAdd(lhs, rhs) +// } +} diff --git a/EllipticSwift/Curve/GeneralizedWeirstrassCurve.swift b/EllipticSwift/Curve/GeneralizedWeirstrassCurve.swift new file mode 100644 index 0000000..cefd3f7 --- /dev/null +++ b/EllipticSwift/Curve/GeneralizedWeirstrassCurve.swift @@ -0,0 +1,321 @@ +// +// GeneralizedWeirstrassCurve.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public class GeneralizedWeierstrassCurve: CurveProtocol where T: PrimeFieldProtocol { + public typealias Field = T + public typealias FieldElement = GeneralizedPrimeFieldElement + public typealias UnderlyingRawType = T.UnderlyingRawType + public typealias FE = FieldElement + public typealias AffineType = GeneralizedAffinePoint> + public typealias ProjectiveType = GeneralizedProjectivePoint> + public var field: T + public var order: UnderlyingRawType + public var curveOrderField: T + public var A: FE + public var B: FE +// public var generator: GeneralizedAffinePoint>? + + internal var aIsZero: Bool = false + internal var bIsZero: Bool = false + + public init(field: T, order: UnderlyingRawType, A: UnderlyingRawType, B: UnderlyingRawType) { + self.field = field + self.order = order + let reducedA = FE.fromValue(A, field: field) + let reducedB = FE.fromValue(B, field: field) + if A.isZero { + self.aIsZero = true + } + if B.isZero { + self.bIsZero = true + } + self.A = reducedA + self.B = reducedB + let FOUR: FE = FE.fromValue(UInt64(4), field: field) + var det = FOUR * self.A * self.A * self.A + let TWENTYSEVEN: FE = FE.fromValue(UInt64(27), field: field) + det = det + TWENTYSEVEN * self.B * self.B + precondition(!det.isZero, "Creating a curve with 0 determinant") + self.curveOrderField = T(self.order) + } + + public func testGenerator(_ p: AffineCoordinates) -> Bool { + if p.isInfinity { + return false + } + let reducedGeneratorX = FE.fromValue(p.X, field: self.field) + let reducedGeneratorY = FE.fromValue(p.Y, field: self.field) + let generatorPoint = AffineType(reducedGeneratorX, reducedGeneratorY, self) + if !checkOnCurve(generatorPoint) { + return false + } + if !self.mul(self.order, generatorPoint).isInfinity { + return false + } +// self.generator = generatorPoint + return true + } + + public func checkOnCurve(_ p: AffineType) -> Bool { + if p.isInfinity { + return false + } + let lhs = p.rawY * p.rawY // y^2 + var rhs = p.rawX * p.rawX * p.rawX + if !self.aIsZero { + rhs = rhs + self.A * p.rawX // x^3 + a*x + } + if !self.bIsZero { + rhs = rhs + self.B // x^3 + a*x + b + } + return lhs == rhs + } + + public func toPoint(_ x: BigUInt, _ y: BigUInt) -> AffineType? { + return toPoint(AffineCoordinates(x, y)) + } + + public func toPoint(_ p: AffineCoordinates) -> AffineType? { + let reducedX = FE.fromValue(p.X, field: self.field) + let reducedY = FE.fromValue(p.Y, field: self.field) + let point = AffineType(reducedX, reducedY, self) + if !checkOnCurve(point) { + return nil + } + return point + } + + public func hashInto(_ data: Data) -> AffineType { + let bn = UnderlyingRawType(data) + precondition(bn != nil) + var seed = FE.fromValue(bn!, field: self.field) + let ONE = FE.identityElement(field) + for _ in 0 ..< 100 { + let x = seed + var y2 = x * x * x + if !self.aIsZero { + y2 = y2 + self.A * x + } + if !self.bIsZero { + y2 = y2 + self.B + } + // TODO + let yReduced = y2.sqrt() + if y2 == yReduced * yReduced { + return AffineType(x, yReduced, self) + } + seed = seed + ONE + } + precondition(false, "Are you using a normal curve?") + return ProjectiveType.infinityPoint(self).toAffine() + } + + public func add(_ p: ProjectiveType, _ q: ProjectiveType) -> ProjectiveType { + if p.isInfinity { + return q + } + if q.isInfinity { + return p + } + let field = self.field + let pz2 = p.rawZ * p.rawZ// Pz^2 + let pz3 = p.rawZ * pz2 // Pz^3 + let qz2 = q.rawZ * q.rawZ // Pz^2 + let qz3 = q.rawZ * qz2 // Pz^3 + let u1 = p.rawX * qz2 // U1 = X1*Z2^2 + let s1 = p.rawY * qz3 // S1 = Y1*Z2^3 + let u2 = q.rawX * pz2 // U2 = X2*Z1^2 + let s2 = q.rawY * pz3 // S2 = Y2*Z1^3 + // Pu, Ps, Qu, Qs + if u1 == u2 { // U1 == U2 + if s1 != s2 { // S1 != S2 + return ProjectiveType.infinityPoint(self) + } + else { + return double(p) + } + } + let h = u2 - u1 // U2 - U1 + let r = s2 - s1 // S2 - S1 + let h2 = h * h // h^2 + let h3 = h2 * h // h^3 + var rx = r * r // r^2 + rx = rx - h3 // r^2 - h^3 + let uh2 = u1 * h2 // U1*h^2 + let TWO = FE.fromValue(UInt64(2), field: field) + rx = rx - (TWO * uh2) // r^2 - h^3 - 2*U1*h^2 + var ry = uh2 - rx // U1*h^2 - rx + ry = r * ry // r*(U1*h^2 - rx) + ry = ry - (s1 * h3) // R*(U1*H^2 - X3) - S1*H^3 + let rz = h * p.rawZ * q.rawZ // H*Z1*Z2 + return ProjectiveType(rx, ry, rz, self) + } + + public func neg(_ p: ProjectiveType) -> ProjectiveType { + return ProjectiveType(p.rawX, p.rawY.negate(), p.rawZ, self) + } + + public func sub(_ p: ProjectiveType, _ q: ProjectiveType) -> ProjectiveType { + return self.add(p, neg(q)) + } + + public func double(_ p: ProjectiveType) -> ProjectiveType { + if p.isInfinity { + return ProjectiveType.infinityPoint(self) + } + let field = self.field + let px = p.rawX + let py = p.rawY + let py2 = py * py + let FOUR = FE.fromValue(UInt64(4), field: field) + let THREE = FE.fromValue(UInt64(3), field: field) + var s = FOUR * px + s = s * py2 + var m = THREE * px + m = m * px + if !self.aIsZero { + let z2 = p.rawZ * p.rawZ + m = m + z2 * z2 * self.A // m = m + z^4*A + } + let qx = m * m - s - s // m^2 - 2*s + let TWO = FE.fromValue(UInt64(2), field: field) + let EIGHT = FE.fromValue(UInt64(8), field: field) + let qy = m * (s - qx) - (EIGHT * py2 * py2) + let qz = TWO * py * p.rawZ + return ProjectiveType(qx, qy, qz, self) + } + + public func mixedAdd(_ p: ProjectiveType, _ q: AffineType) -> ProjectiveType { + if p.isInfinity { + return q.toProjective() + } + if q.isInfinity { + return p + } + let field = self.field + let pz2 = p.rawZ * p.rawZ // Pz^2 + let pz3 = p.rawZ * pz2 // Pz^3 + + let u1 = p.rawX // U1 = X1*Z2^2 + let s1 = p.rawY // S1 = Y1*Z2^3 + let u2 = q.rawX * pz2 // U2 = X2*Z1^2 + let s2 = q.rawY * pz3 // S2 = Y2*Z1^3 + if u1 == u2 { + if s1 != s2 { + return ProjectiveType.infinityPoint(self) + } + else { + return double(p) + } + } + let h = u2 - u1 + let r = s2 - s1 // S2 - S1 + let h2 = h * h // h^2 + let h3 = h2 * h// h^3 + var rx = r * r // r^2 + rx = rx - h3 // r^2 - h^3 + let uh2 = u1 * h2 // U1*h^2 + let TWO = FE.fromValue(UInt64(2), field: field) + rx = rx - (TWO * uh2) // r^2 - h^3 - 2*U1*h^2 + var ry = uh2 - rx // U1*h^2 - rx + ry = r * ry // r*(U1*h^2 - rx) + ry = ry - (s1 * h3) // R*(U1*H^2 - X3) - S1*H^3 + let rz = h * p.rawZ // H*Z1*Z2 + return ProjectiveType(rx, ry, rz, self) + } + + // public func mul(_ scalar: BigUInt, _ p: AffinePoint) -> ProjectivePoint { + // return wNAFmul(scalar, p) + // } + +// public func mul(_ scalar: GeneralPrimeFieldElement, _ p: AffineType) -> ProjectiveType { +// return wNAFmul(scalar.value, p) +// } + +// public func mul(_ scalar: BigNumber, _ p: AffineType) -> ProjectiveType { +// return wNAFmul(scalar, p) +// } + +// public func mul(_ scalar: GeneralizedPrimeFieldElement, _ p: AffineType) -> ProjectiveType { +// let nativeScalar = scalar.nativeValue +// if nativeScalar is UnderlyingRawType { +// return doubleAndAddMul(nativeScalar as! UnderlyingRawType, p) +// } else { +// let a = Field.f +// let thisNative = T.fromBytes(nativeScalar.bytes).nativeValue +// return doubleAndAddMul(thisNative as! UnderlyingRawType, p) +// } +// } +// +// public func mul(_ scalar: BytesRepresentable, _ p: AffineType) -> ProjectiveType { +// let thisNative = T.fromBytes(scalar.bytes).nativeValue +// return doubleAndAddMul(thisNative as! UnderlyingRawType, p) +// } + + public func mul(_ scalar: UnderlyingRawType, _ p: AffineType) -> ProjectiveType { +// return doubleAndAddMul(scalar, p) + return wNAFmul(scalar, p) + } + + func doubleAndAddMul(_ scalar: UnderlyingRawType, _ p: AffineType) -> ProjectiveType { + var base = p.toProjective() + var result = ProjectiveType.infinityPoint(self) + let bitwidth = scalar.bitWidth + for i in 0 ..< bitwidth { + if scalar.bit(i) { + result = self.add(result, base) + } + if i == scalar.bitWidth - 1 { + break + } + base = self.double(base) + } + return result + } + + func wNAFmul(_ scalar: UnderlyingRawType, _ p: AffineType, windowSize: Int = DefaultWindowSize) -> ProjectiveType { + if scalar.isZero { + return ProjectiveType.infinityPoint(self) + } + if p.isInfinity { + return ProjectiveType.infinityPoint(self) + } + let reducedScalar = scalar.mod(self.order) + let projectiveP = p.toProjective() + let numPrecomputedElements = (1 << (windowSize-2)) // 2**(w-1) precomputations required + var precomputations = [ProjectiveType]() // P, 3P, 5P, 7P, 9P, 11P, 13P, 15P ... + precomputations.append(projectiveP) + let dbl = double(projectiveP) + precomputations.append(mixedAdd(dbl, p)) + for i in 2 ..< numPrecomputedElements { + precomputations.append(add(precomputations[i-1], dbl)) + } + let lookups = computeWNAF(scalar: reducedScalar, windowSize: windowSize) + var result = ProjectiveType.infinityPoint(self) + let range = (0 ..< lookups.count).reversed() + for i in range { + result = double(result) + let lookup = lookups[i] + if lookup == 0 { + continue + } else if lookup > 0 { + let idx = lookup >> 1 + let precomputeToAdd = precomputations[idx] + result = add(result, precomputeToAdd) + } else if lookup < 0 { + let idx = -lookup >> 1 + let precomputeToAdd = neg(precomputations[idx]) + result = add(result, precomputeToAdd) + } + } + return result + } +} diff --git a/EllipticSwift/Curve/PrecompiledCurves.swift b/EllipticSwift/Curve/PrecompiledCurves.swift new file mode 100644 index 0000000..a29f50e --- /dev/null +++ b/EllipticSwift/Curve/PrecompiledCurves.swift @@ -0,0 +1,40 @@ +// +// PrecompiledCurves.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 10.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +// secp256k1 +internal let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! +public let secp256k1Prime = U256(secp256k1PrimeBUI.serialize())! +let secp256k1PrimeField = GeneralizedMontPrimeField(secp256k1PrimeBUI) +internal let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! +public let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! +public let secp256k1Curve: GeneralizedWeierstrassCurve> = { + let curve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = curve.testGenerator(AffineCoordinates(generatorX, generatorY)) + precondition(success, "Failed to init secp256k1 curve!") + return curve +}() + +// bn256 +internal let bn256PrimeBUI = BigUInt("21888242871839275222246405745257275088696311157297823662689037894645226208583", radix: 10)! +public let bn256Prime = U256(bn256PrimeBUI.serialize())! +public let bn256PrimeField = GeneralizedMontPrimeField(bn256PrimeBUI) +internal let bn256CurveOrderBUI = BigUInt("21888242871839275222246405745257275088548364400416034343698204186575808495617", radix: 10)! +public let bn256CurveOrder = U256(bn256CurveOrderBUI.serialize())! +public let bn256Curve: GeneralizedWeierstrassCurve> = { + let curve = GeneralizedWeierstrassCurve(field: bn256PrimeField, order: bn256CurveOrder, A: U256(0), B: U256(3)) + let generatorX = BigUInt("1", radix: 10)! + let generatorY = BigUInt("2", radix: 10)! + let success = curve.testGenerator(AffineCoordinates(generatorX, generatorY)) + precondition(success, "Failed to init bn256 curve!") + return curve +}() diff --git a/EllipticSwift/EllipticSwift.h b/EllipticSwift/EllipticSwift.h new file mode 100644 index 0000000..d64a292 --- /dev/null +++ b/EllipticSwift/EllipticSwift.h @@ -0,0 +1,19 @@ +// +// EllipticSwift.h +// EllipticSwift +// +// Created by Alexander Vlasov on 07.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +#import + +//! Project version number for EllipticSwift. +FOUNDATION_EXPORT double EllipticSwiftVersionNumber; + +//! Project version string for EllipticSwift. +FOUNDATION_EXPORT const unsigned char EllipticSwiftVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/EllipticSwift/Extensions/Data+Bytes.swift b/EllipticSwift/Extensions/Data+Bytes.swift new file mode 100644 index 0000000..ac2c2df --- /dev/null +++ b/EllipticSwift/Extensions/Data+Bytes.swift @@ -0,0 +1,15 @@ +// +// Data+Bytes.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 07.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation + +extension Data { + public var bytes: [UInt8] { + return Array(self) + } +} diff --git a/EllipticSwift/Field/FieldProtocols.swift b/EllipticSwift/Field/FieldProtocols.swift new file mode 100644 index 0000000..b8f485e --- /dev/null +++ b/EllipticSwift/Field/FieldProtocols.swift @@ -0,0 +1,82 @@ +// +// Protocols.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public protocol PrimeFieldElementProtocol: Equatable { + associatedtype Field: PrimeFieldProtocol + + var rawValue: Field.UnderlyingRawType {get} + + func isEqualTo(_ other: Self) -> Bool + + var value: BigUInt {get} + var nativeValue: Field.UnderlyingRawType {get} + var isZero: Bool {get} + var field: Field {get} + + init(_ rawValue: Field.UnderlyingRawType, _ field: Field) + + static func == (lhs: Self, rhs: Self) -> Bool + static func + (lhs: Self, rhs: Self) -> Self + static func - (lhs: Self, rhs: Self) -> Self + static func * (lhs: Self, rhs: Self) -> Self + static func * (lhs: BytesRepresentable, rhs: Self) -> Self + static func + (lhs: BytesRepresentable, rhs: Self) -> Self + func pow(_ a: BytesRepresentable) -> Self + func inv() -> Self + func sqrt() -> Self + func negate() -> Self + + static func fromValue(_ a: BigUInt, field: Field) -> Self + static func fromValue(_ a: BytesRepresentable, field: Field) -> Self + static func fromValue(_ a: Field.UnderlyingRawType, field: Field) -> Self + static func fromValue(_ a: UInt64, field: Field) -> Self + static func fromBytes(_ a: Data, field: Field) -> Self + static func toValue(_ a: Field.UnderlyingRawType, field: Field) -> BigUInt + static func toValue(_ a: Field.UnderlyingRawType, field: Field) -> Field.UnderlyingRawType + static func identityElement(_ field: Field) -> Self + static func zeroElement(_ field: Field) -> Self + +} + +public protocol PrimeFieldProtocol { + associatedtype UnderlyingRawType: FiniteFieldCompatible // U256, U512... + + var modulus: BigUInt {get} + + init(_ p: BigUInt) + init(_ p: BytesRepresentable) + init(_ p: UnderlyingRawType) + + func isEqualTo(_ other: Self) -> Bool + + func add(_ a: UnderlyingRawType, _ b: UnderlyingRawType) -> UnderlyingRawType + func sub(_ a: UnderlyingRawType, _ b: UnderlyingRawType) -> UnderlyingRawType + func neg(_ a: UnderlyingRawType) -> UnderlyingRawType + func mul(_ a: UnderlyingRawType, _ b: UnderlyingRawType) -> UnderlyingRawType + func div(_ a: UnderlyingRawType, _ b: UnderlyingRawType) -> UnderlyingRawType + func inv(_ a: UnderlyingRawType) -> UnderlyingRawType + func pow(_ a: UnderlyingRawType, _ b: UnderlyingRawType) -> UnderlyingRawType + func pow(_ a: UnderlyingRawType, _ b: BytesRepresentable) -> UnderlyingRawType + func sqrt(_ a: UnderlyingRawType) -> UnderlyingRawType + func reduce(_ a: BytesRepresentable) -> UnderlyingRawType + func reduce(_ a: UnderlyingRawType) -> UnderlyingRawType + func fromValue(_ a: BigUInt) -> UnderlyingRawType + func fromValue(_ a: BytesRepresentable) -> UnderlyingRawType + func fromValue(_ a: UnderlyingRawType) -> UnderlyingRawType + func fromValue(_ a: UInt64) -> UnderlyingRawType + func fromBytes(_ a: Data) -> UnderlyingRawType + func toValue(_ a: UnderlyingRawType) -> BigUInt + func toValue(_ a: UnderlyingRawType) -> UnderlyingRawType + + var identityElement: UnderlyingRawType {get} + var zeroElement: UnderlyingRawType {get} +} + diff --git a/EllipticSwift/Field/GeneralizedMontPrimeField.swift b/EllipticSwift/Field/GeneralizedMontPrimeField.swift new file mode 100644 index 0000000..1528c63 --- /dev/null +++ b/EllipticSwift/Field/GeneralizedMontPrimeField.swift @@ -0,0 +1,262 @@ +// +// GeneralizedMontField.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public class GeneralizedMontPrimeField: PrimeFieldProtocol where T: FiniteFieldCompatible, T: MontArithmeticsCompatible { + public typealias UnderlyingRawType = T +// public typealias UnderlyingFieldElementType = GeneralizedPrimeFieldElement> + +// internal func fromByte(_ a: UInt8) -> UnderlyingRawType { +// let t = T(Data([a])) +// precondition(t != nil) +// let reduced = t!.toMontForm(self.prime) +// return reduced +// } + + public func reduce(_ a: BytesRepresentable) -> T { + let t = T(a.bytes) + precondition(t != nil) + let reduced = t!.toMontForm(self.prime) + return reduced + } + + public func reduce(_ a: T) -> T { + let reduced = a.toMontForm(self.prime) + return reduced + } + + public func isEqualTo(_ other: GeneralizedMontPrimeField) -> Bool { + return self.prime == other.prime + } + + public var modulus: BigUInt { + return BigUInt(self.prime.bytes) + } + + public func toValue(_ a: UnderlyingRawType) -> BigUInt { + let normalValue = a.modMultiply(self.montInvR, self.prime) + // (a.rawValue*self.montInvR) % self.prime + let bytes = normalValue.bytes + return BigUInt(bytes) + } + + public func toValue(_ a: UnderlyingRawType) -> UnderlyingRawType { + let normalValue = a.modMultiply(self.montInvR, self.prime) + return normalValue + } + + public required init(_ p: BytesRepresentable) { + let nativeType: T? = T(p.bytes) + precondition(nativeType != nil) + self.prime = nativeType! + let (montR, montInvR, montK) = T.getMontParams(self.prime) + self.montR = montR + self.montInvR = montInvR + self.montK = montK + } + + public required init(_ p: BigUInt) { + let nativeType: T? = T(p.serialize()) + precondition(nativeType != nil) + self.prime = nativeType! + let (montR, montInvR, montK) = T.getMontParams(self.prime) + self.montR = montR + self.montInvR = montInvR + self.montK = montK + } + public required init(_ p: T) { + self.prime = p + let (montR, montInvR, montK) = T.getMontParams(self.prime) + self.montR = montR + self.montInvR = montInvR + self.montK = montK + } + + public var prime: UnderlyingRawType + public var montR: UnderlyingRawType + public var montInvR: UnderlyingRawType + public var montK: UnderlyingRawType + + public func add(_ a: T, _ b: T) -> T { + let space = self.prime - a // q - a + if (b >= space) { + return b - space + } else { + return b + a + } + } + + internal func toElement(_ a: T) -> GeneralizedPrimeFieldElement> { + return GeneralizedPrimeFieldElement>(a, self) + } + + public func sub(_ a: T, _ b: T) -> T { + if a >= b { + return a - b + } else { + return self.prime - (b - a) + } + } + + public func neg(_ a: T) -> T { + return self.prime - a + } + + internal func doubleAndAddExponentiation(_ a: T, _ b: T) -> T { + var base = a + var result = self.identityElement + let bitwidth = b.bitWidth + for i in 0 ..< bitwidth { + if b.bit(i) { + result = self.mul(result, base) + } + if i == b.bitWidth - 1 { + break + } + base = mul(base, base) + } + return result + } + + internal func kSlidingWindowExponentiation(_ a: T, _ b: T, windowSize: Int = DefaultWindowSize) -> T { + let numPrecomputedElements = (1 << windowSize) - 1 // 2**k - 1 + var precomputations = [T](repeating: self.identityElement, count: numPrecomputedElements) + precomputations[0] = a + precomputations[1] = self.mul(a, a) + for i in 2 ..< numPrecomputedElements { + precomputations[i] = self.mul(precomputations[i-2], precomputations[1]) + } + var result = self.identityElement + let (lookups, powers) = computeSlidingWindow(scalar: b, windowSize: windowSize) + for i in 0 ..< lookups.count { + let lookupCoeff = lookups[i] + if lookupCoeff == -1 { + result = self.mul(result, result) + } else { + let power = powers[i] + let intermediatePower = self.doubleAndAddExponentiation(result, T(power)) // use trivial form to don't go recursion + result = self.mul(intermediatePower, precomputations[lookupCoeff]) + } + } + return result + } + + public func mul(_ a: T, _ b: T) -> T { + // multiplication in Mont. reduced field + return self.montMul(a, b) + } + + func montMul(_ a: T, _ b: T) -> T { + let res = a.montMul(b, modulus: self.prime, montR: self.montR, montInvR: self.montInvR, montK: self.montK) + return res + } + + public func div(_ a: T, _ b: T) -> T { + return self.mul(a, self.inv(b)) + } + + public func inv(_ a: T) -> T { + // TODO: inversion in Mont. field natively + let TWO = T(UInt64(2)) + let power = self.prime - TWO + return self.pow(a, power) + // return self.toElement(a.rawValue.modInv(self.prime)) + } + + public func pow(_ a: T, _ b: T) -> T { + if b == 0 { + return self.identityElement + } + if b == 1 { + return a + } + return self.doubleAndAddExponentiation(a, b) + } + + public func pow(_ a: T, _ b: BytesRepresentable) -> T { + let t = T(b.bytes) + precondition(t != nil) + return self.pow(a, t!) + } + + public func sqrt(_ a: T) -> T { + if a.isZero { + return a + } + let ONE = T(UInt64(1)) + let TWO = T(UInt64(2)) + let THREE = T(UInt64(3)) + let FOUR = T(UInt64(4)) + // let EIGHT = T(Data(repeating: 8, count: 1))! + let mod4 = self.prime.mod(FOUR) + precondition(mod4.mod(TWO) == ONE) + + // Fast case + if (mod4 == THREE) { + let (power, _) = (self.prime + ONE).div(FOUR) + return self.pow(a, power) + } + precondition(false, "NYI") + return self.zeroElement + } + + public func fromValue(_ a: BytesRepresentable) -> UnderlyingRawType { + let t = T(a.bytes) + precondition(t != nil) + let reduced = t!.toMontForm(self.prime) + return reduced +// let fe = UnderlyingFieldElementType(reduced, self) +// return fe + } + + public func fromValue(_ a: BigUInt) -> UnderlyingRawType { + let t = T(a.serialize()) + precondition(t != nil) + let reduced = t!.toMontForm(self.prime) + return reduced +// let fe = UnderlyingFieldElementType(reduced, self) +// return fe + } + + public func fromValue(_ a: T) -> UnderlyingRawType { + let reduced = a.toMontForm(self.prime) + return reduced +// let fe = UnderlyingFieldElementType(reduced, self) +// return fe + } + + public func fromValue(_ a: UInt64) -> UnderlyingRawType { + let t = T(a) + let reduced = t.toMontForm(self.prime) + return reduced +// let fe = UnderlyingFieldElementType(reduced, self) +// return fe + } + + public func fromBytes(_ a: Data) -> UnderlyingRawType { + let t = T(a) + precondition(t != nil) + let reduced = t!.toMontForm(self.prime) + return reduced +// let fe = UnderlyingFieldElementType(reduced, self) +// return fe + } + + public var identityElement: UnderlyingRawType { + let element = self.fromValue(UInt64(1)) + return element + } + + public var zeroElement: UnderlyingRawType { + let element = self.fromValue(UInt64(0)) + return element + } +} + diff --git a/EllipticSwift/Field/GeneralizedNaivePrimeField.swift b/EllipticSwift/Field/GeneralizedNaivePrimeField.swift new file mode 100644 index 0000000..85180f0 --- /dev/null +++ b/EllipticSwift/Field/GeneralizedNaivePrimeField.swift @@ -0,0 +1,237 @@ +// +// GeneralizedNaivePrimeField.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public class GeneralizedNaivePrimeField: PrimeFieldProtocol where T: FiniteFieldCompatible { + public typealias UnderlyingRawType = T + // public typealias UnderlyingFieldElementType = GeneralizedPrimeFieldElement> + + // internal func fromByte(_ a: UInt8) -> UnderlyingRawType { + // let t = T(Data([a])) + // precondition(t != nil) + // let reduced = t!.toMontForm(self.prime) + // return reduced + // } + + public func reduce(_ a: BytesRepresentable) -> T { + let t = T(a.bytes) + precondition(t != nil) + let reduced = t! + return reduced + } + + public func reduce(_ a: T) -> T { + let reduced = a + return reduced + } + + public func isEqualTo(_ other: GeneralizedNaivePrimeField) -> Bool { + return self.prime == other.prime + } + + public var modulus: BigUInt { + return BigUInt(self.prime.bytes) + } + + public func toValue(_ a: UnderlyingRawType) -> BigUInt { + let bytes = a.bytes + return BigUInt(bytes) + } + + public func toValue(_ a: UnderlyingRawType) -> UnderlyingRawType { + return a + } + + public required init(_ p: BytesRepresentable) { + let nativeType: T? = T(p.bytes) + precondition(nativeType != nil) + self.prime = nativeType! + } + + public required init(_ p: BigUInt) { + let nativeType: T? = T(p.serialize()) + precondition(nativeType != nil) + self.prime = nativeType! + } + public required init(_ p: T) { + self.prime = p + } + + public var prime: UnderlyingRawType + + public func add(_ a: T, _ b: T) -> T { + let space = self.prime - a // q - a + if (b >= space) { + return b - space + } else { + return b + a + } + } + + internal func toElement(_ a: T) -> GeneralizedPrimeFieldElement> { + return GeneralizedPrimeFieldElement>(a, self) + } + + public func sub(_ a: T, _ b: T) -> T { + if a >= b { + return a - b + } else { + return self.prime - (b - a) + } + } + + public func neg(_ a: T) -> T { + return self.prime - a + } + + internal func doubleAndAddExponentiation(_ a: T, _ b: T) -> T { + var base = a + var result = self.identityElement + let bitwidth = b.bitWidth + for i in 0 ..< bitwidth { + if b.bit(i) { + result = self.mul(result, base) + } + if i == b.bitWidth - 1 { + break + } + base = mul(base, base) + } + return result + } + + internal func kSlidingWindowExponentiation(_ a: T, _ b: T, windowSize: Int = DefaultWindowSize) -> T { + let numPrecomputedElements = (1 << windowSize) - 1 // 2**k - 1 + var precomputations = [T](repeating: self.identityElement, count: numPrecomputedElements) + precomputations[0] = a + precomputations[1] = self.mul(a, a) + for i in 2 ..< numPrecomputedElements { + precomputations[i] = self.mul(precomputations[i-2], precomputations[1]) + } + var result = self.identityElement + let (lookups, powers) = computeSlidingWindow(scalar: b, windowSize: windowSize) + for i in 0 ..< lookups.count { + let lookupCoeff = lookups[i] + if lookupCoeff == -1 { + result = self.mul(result, result) + } else { + let power = powers[i] + let intermediatePower = self.doubleAndAddExponentiation(result, T(power)) // use trivial form to don't go recursion + result = self.mul(intermediatePower, precomputations[lookupCoeff]) + } + } + return result + } + + public func mul(_ a: T, _ b: T) -> T { + return a.modMultiply(b, self.prime) + } + + public func div(_ a: T, _ b: T) -> T { + return self.mul(a, self.inv(b)) + } + + public func inv(_ a: T) -> T { + // TODO: inversion in Mont. field natively + let TWO = T(UInt64(2)) + let power = self.prime - TWO + return self.pow(a, power) + // return self.toElement(a.rawValue.modInv(self.prime)) + } + + public func pow(_ a: T, _ b: T) -> T { + if b == 0 { + return self.identityElement + } + if b == 1 { + return a + } + return self.doubleAndAddExponentiation(a, b) + } + + public func pow(_ a: T, _ b: BytesRepresentable) -> T { + let t = T(b.bytes) + precondition(t != nil) + return self.pow(a, t!) + } + + public func sqrt(_ a: T) -> T { + if a.isZero { + return a + } + let ONE = T(UInt64(1)) + let TWO = T(UInt64(2)) + let THREE = T(UInt64(3)) + let FOUR = T(UInt64(4)) + // let EIGHT = T(Data(repeating: 8, count: 1))! + let mod4 = self.prime.mod(FOUR) + precondition(mod4.mod(TWO) == ONE) + + // Fast case + if (mod4 == THREE) { + let (power, _) = (self.prime + ONE).div(FOUR) + return self.pow(a, power) + } + precondition(false, "NYI") + return self.zeroElement + } + + public func fromValue(_ a: BytesRepresentable) -> UnderlyingRawType { + let t = T(a.bytes) + precondition(t != nil) + let reduced = t! + return reduced + // let fe = UnderlyingFieldElementType(reduced, self) + // return fe + } + + public func fromValue(_ a: BigUInt) -> UnderlyingRawType { + let t = T(a.serialize()) + precondition(t != nil) + let reduced = t! + return reduced + // let fe = UnderlyingFieldElementType(reduced, self) + // return fe + } + + public func fromValue(_ a: T) -> UnderlyingRawType { + let reduced = a + return reduced + // let fe = UnderlyingFieldElementType(reduced, self) + // return fe + } + + public func fromValue(_ a: UInt64) -> UnderlyingRawType { + let t = T(a) + let reduced = t + return reduced + // let fe = UnderlyingFieldElementType(reduced, self) + // return fe + } + + public func fromBytes(_ a: Data) -> UnderlyingRawType { + let t = T(a) + precondition(t != nil) + let reduced = t! + return reduced + // let fe = UnderlyingFieldElementType(reduced, self) + // return fe + } + + public var identityElement: UnderlyingRawType { + let element = self.fromValue(UInt64(1)) + return element + } + + public var zeroElement: UnderlyingRawType { + let element = self.fromValue(UInt64(0)) + return element + } +} diff --git a/EllipticSwift/Field/GeneralizedPrimeFieldElement.swift b/EllipticSwift/Field/GeneralizedPrimeFieldElement.swift new file mode 100644 index 0000000..6a780cf --- /dev/null +++ b/EllipticSwift/Field/GeneralizedPrimeFieldElement.swift @@ -0,0 +1,141 @@ +// +// GeneralizedPrimeFieldElement.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 02.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import BigInt + +public struct GeneralizedPrimeFieldElement: PrimeFieldElementProtocol where U: PrimeFieldProtocol { + public typealias Field = U + public typealias SelfType = GeneralizedPrimeFieldElement + + public static func fromValue(_ a: BigUInt, field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.fromValue(a) + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func fromValue(_ a: BytesRepresentable, field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.fromValue(a) + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func fromValue(_ a: U.UnderlyingRawType, field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.fromValue(a) + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func fromValue(_ a: UInt64, field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.fromValue(a) + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func fromBytes(_ a: Data, field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.fromBytes(a) + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func toValue(_ a: Field.UnderlyingRawType, field: Field) -> BigUInt { + let normal: BigUInt = field.toValue(a) + return normal + } + + public static func toValue(_ a: Field.UnderlyingRawType, field: Field) -> U.UnderlyingRawType { + let normal: U.UnderlyingRawType = field.toValue(a) + return normal + } + + public static func identityElement(_ field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.identityElement + return GeneralizedPrimeFieldElement(reduced, field) + } + + public static func zeroElement(_ field: Field) -> GeneralizedPrimeFieldElement { + let reduced = field.zeroElement + return GeneralizedPrimeFieldElement(reduced, field) + } + + public func isEqualTo(_ other: SelfType) -> Bool { + return self.rawValue == other.rawValue + } + + public var rawValue: Field.UnderlyingRawType + + public init(_ rawValue: Field.UnderlyingRawType, _ field: Field) { + self.rawValue = rawValue + self.field = field + } + + public var isZero: Bool { + return self.rawValue.isZero + } + public var field: Field + + public var value: BigUInt { + get { + return GeneralizedPrimeFieldElement.toValue(self.rawValue, field: self.field) +// return self.field.toValue(self.rawValue) + } + } + + public var nativeValue: Field.UnderlyingRawType { + get { + return GeneralizedPrimeFieldElement.toValue(self.rawValue, field: self.field) +// return self.field.toValue(self.rawValue) + } + } + + public static func == (lhs: SelfType, rhs: SelfType) -> Bool { + return lhs.rawValue == rhs.rawValue + } + public static func + (lhs: SelfType, rhs: SelfType) -> SelfType { + let raw = lhs.field.add(lhs.rawValue, rhs.rawValue) + return GeneralizedPrimeFieldElement(raw, lhs.field) + } + public static func - (lhs: SelfType, rhs: SelfType) -> SelfType { + let raw = lhs.field.sub(lhs.rawValue, rhs.rawValue) + return GeneralizedPrimeFieldElement(raw, lhs.field) + } + public static func * (lhs: SelfType, rhs: SelfType) -> SelfType { + let raw = lhs.field.mul(lhs.rawValue, rhs.rawValue) + return GeneralizedPrimeFieldElement(raw, lhs.field) + } + public static func * (lhs: BytesRepresentable, rhs: SelfType) -> SelfType { + let newFE = rhs.field.reduce(lhs) + let raw = rhs.field.mul(newFE, rhs.rawValue) + return GeneralizedPrimeFieldElement(raw, rhs.field) + } + public static func + (lhs: BytesRepresentable, rhs: SelfType) -> SelfType { + let newFE = rhs.field.reduce(lhs) + let raw = rhs.field.add(newFE, rhs.rawValue) + return GeneralizedPrimeFieldElement(raw, rhs.field) + } + public func pow(_ a: BytesRepresentable) -> SelfType { + let p = Field.UnderlyingRawType(a.bytes) + precondition(p != nil) + let raw = self.field.pow(self.rawValue, p!) + return GeneralizedPrimeFieldElement(raw, self.field) + } + public func pow(_ a: Field.UnderlyingRawType) -> SelfType { + let raw = self.field.pow(self.rawValue, a) + return GeneralizedPrimeFieldElement(raw, self.field) + } + public func inv() -> SelfType { + let raw = self.field.inv(self.rawValue) + return GeneralizedPrimeFieldElement(raw, self.field) + } + public func sqrt() -> SelfType { + let raw = self.field.sqrt(self.rawValue) + return GeneralizedPrimeFieldElement(raw, self.field) + } + public func negate() -> SelfType { + let raw = self.field.neg(self.rawValue) + return GeneralizedPrimeFieldElement(raw, self.field) + } +} + + + diff --git a/EllipticSwift/FixedWidthTypes/FiniteWidthInteger.swift b/EllipticSwift/FixedWidthTypes/FiniteWidthInteger.swift new file mode 100644 index 0000000..ec883d4 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/FiniteWidthInteger.swift @@ -0,0 +1,73 @@ +// +// FiniteWidthInteger.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +public typealias U256 = vU256 +public typealias U512 = vU512 +public typealias U1024 = vU1024 + +extension U256: FiniteFieldCompatible { +} + +public protocol FiniteFieldCompatible: Comparable, Numeric, ModReducable, BytesInitializable, BitsAndBytes, BitShiftable, EvenOrOdd, UInt64Initializable { +} + +public protocol BitsAndBytes: BytesRepresentable, BitAccessible, FixedWidth, Zeroable { +} + +public protocol UInt64Initializable { + init(_ value: UInt64) +} + +public protocol BytesInitializable { + init? (_ bytes: Data) +} + +public protocol BytesRepresentable { + var bytes: Data {get} +} + +public protocol Zeroable { + var isZero: Bool {get} + static var zero: Self {get} +} + +public protocol EvenOrOdd { + var isEven: Bool {get} +} + +public protocol BitAccessible { + func bit(_ i: Int) -> Bool +} + +public protocol FixedWidth { + var bitWidth: Int {get} + var leadingZeroBitCount: Int {get} + var fullBitWidth: UInt32 {get} +} + +public protocol BitShiftable { + static func >> (lhs: Self, rhs: UInt32) -> Self + static func << (lhs: Self, rhs: UInt32) -> Self +} + +public protocol ModReducable { + func modMultiply(_ a: Self, _ modulus: Self) -> Self + func mod(_ modulus: Self) -> Self + func modInv(_ modulus: Self) -> Self + func div(_ a: Self) -> (Self, Self) + func fullMultiply(_ a: Self) -> (Self, Self) +} + +public protocol MontArithmeticsCompatible { + static func getMontParams(_ a: Self) -> (Self, Self, Self) + func toMontForm(_ modulus: Self) -> Self + func montMul(_ b: Self, modulus: Self, montR: Self, montInvR: Self, montK: Self) -> Self +} diff --git a/EllipticSwift/FixedWidthTypes/U128/U128+BitAccessible.swift b/EllipticSwift/FixedWidthTypes/U128/U128+BitAccessible.swift new file mode 100644 index 0000000..aba0437 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U128/U128+BitAccessible.swift @@ -0,0 +1,27 @@ +// +// U128+BitAccessible.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 19.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U128: BitAccessible { + public func bit(_ i: Int) -> Bool { + if i < 0 { + return false + } else if i < 32 { + return self.v.x & (UInt32(1) << i) > 0 + } else if i < 64 { + return self.v.y & (UInt32(1) << (i-32)) > 0 + } else if i < 96 { + return self.v.z & (UInt32(1) << (i-64)) > 0 + } else if i < 128 { + return self.v.w & (UInt32(1) << (i-96)) > 0 + } + return false + } +} diff --git a/EllipticSwift/FixedWidthTypes/U128/U128+Comparable.swift b/EllipticSwift/FixedWidthTypes/U128/U128+Comparable.swift new file mode 100644 index 0000000..eff5949 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U128/U128+Comparable.swift @@ -0,0 +1,17 @@ +// +// U128+Comparable.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 14.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U128: Comparable { + + public static func < (lhs: U128, rhs: U128) -> Bool { + return lhs.v < rhs.v + } +} diff --git a/EllipticSwift/FixedWidthTypes/U128/U128+Equatable.swift b/EllipticSwift/FixedWidthTypes/U128/U128+Equatable.swift new file mode 100644 index 0000000..f8a28af --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U128/U128+Equatable.swift @@ -0,0 +1,16 @@ +// +// U128+Equitable.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 14.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U128: Equatable { + public static func == (lhs: U128, rhs: U128) -> Bool { + return lhs.v == rhs.v + } +} diff --git a/EllipticSwift/FixedWidthTypes/U128/U128.swift b/EllipticSwift/FixedWidthTypes/U128/U128.swift new file mode 100644 index 0000000..1ada482 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U128/U128.swift @@ -0,0 +1,92 @@ +// +// U128.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate +import simd + +public typealias U128 = vU128 +public var U128bitLength = 128 +public var U128byteLength = 16 +public var U128words = 4 +public var U128vectors = 1 +public var U128MAX = U128(Data(repeating: 255, count: U128byteLength))! +public var U128MIN = U128(Data(repeating: 0, count: U128byteLength))! + +extension U128 { + public static var bitWidth: Int = U128bitLength + public static var max: U128 = U128MAX + public static var min: U128 = U128MIN + + public init(_ value: UInt32) { + self = U128(v: vUInt32(x: value, y: 0, z: 0, w: 0)) + } + + public init?(_ bytes: Data) { // assumes BE bytes + if bytes.count <= U128byteLength { + let padding = Data(repeating: 0, count: U128byteLength - bytes.count) + var fullData = (padding + bytes).bytes + var vectors = [vUInt32](repeating: vZERO, count: U128vectors) + for i in 0 ..< U128vectors { + var words = [UInt32](repeating: 0, count: 4) + for j in 0 ..< 4 { + let idx = i*16 + j*4 + var word: UInt32 = UInt32(fullData[idx + 3]) // encode as BE + word += UInt32(fullData[idx + 2]) << 8 + word += UInt32(fullData[idx + 1]) << 16 + word += UInt32(fullData[idx + 0]) << 24 + words[j] = word + } + let vec = vUInt32(words[3], words[2], words[1], words[0]) + vectors[i] = vec + } + let res = vU128.init(v: vectors[0]) + self = res + } else { + return nil + } + } + + public func add(_ a: U128) -> U128 { + return U128(v: vU128Add(self.v, a.v)) + } + + public func mul(_ a: U128) -> U256 { + var result = U256() + var aCopy = a + var selfCopy = self + vU128FullMultiply(&selfCopy, &aCopy, &result) + return result + } + + public func halfMul(_ a: U128) -> U128 { + return U128(v: vU128HalfMultiply(self.v, a.v)) + } + + public func memoryStructure(_ radix: Int = 16) -> [UInt32] { + let vecs = self.v + var arr = [UInt32]() + arr.append(vecs.x) + arr.append(vecs.y) + arr.append(vecs.z) + arr.append(vecs.w) + return arr + } + + public var clippedValue: UInt64 { + return self.v.clippedValue + } + + public var bytes: Data { + return self.v.bigEndianBytes + } + + public var isZero: Bool { + return self.v.isZero + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Add.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Add.swift new file mode 100644 index 0000000..e554e60 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Add.swift @@ -0,0 +1,26 @@ +// +// U256+Add.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256 { + public func addMod(_ a: U256) -> U256 { + var result = U256() + var aCopy = a + var selfCopy = self + vU256Add(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceAddMod(_ a: U256) { + var aCopy = a + var selfCopy = self + vU256Add(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Aux.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Aux.swift new file mode 100644 index 0000000..d153951 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Aux.swift @@ -0,0 +1,20 @@ +// +// U256+Aux.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256 { + public static var one: U256 { + return vU256(v: (vUInt32(1), vUInt32(0))) + } + + public static var zero: U256 { + return vU256(v: (vZERO, vZERO)) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+BitAccessible.swift b/EllipticSwift/FixedWidthTypes/U256/U256+BitAccessible.swift new file mode 100644 index 0000000..524a335 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+BitAccessible.swift @@ -0,0 +1,47 @@ +// +// U256+BitAccessible.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 19.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: BitAccessible { + public func bit(_ i: Int) -> Bool { + if i < 0 { + return false + } else if i < 128 { + return self.v.0.bit(i) + } else if i < 256 { + return self.v.1.bit(i-128) + } + return false + } +} + +extension U256: FixedWidth { + public var leadingZeroBitCount: Int { + if self.v.1.leadingZeroBitCount != 128 { + return self.v.1.leadingZeroBitCount + } else if self.v.0.leadingZeroBitCount != 128 { + return 128 + self.v.0.leadingZeroBitCount + } + return 256 + } + + public var bitWidth: Int { + if self.v.1.leadingZeroBitCount != 128 { + return 256 - self.v.1.leadingZeroBitCount + } else if self.v.0.leadingZeroBitCount != 128 { + return 128 - self.v.0.leadingZeroBitCount + } + return 256 + } + + public var fullBitWidth: UInt32 { + return 256 + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+BitOps.swift b/EllipticSwift/FixedWidthTypes/U256/U256+BitOps.swift new file mode 100644 index 0000000..d55d2de --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+BitOps.swift @@ -0,0 +1,61 @@ +// +// U256+BitOps.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: BitShiftable { + public func leftShifted(_ a: UInt32) -> U256 { + var result = U256() + var selfCopy = self + withUnsafePointer(to: &selfCopy) { (selfPtr: UnsafePointer) -> Void in + withUnsafeMutablePointer(to: &result, { (resultPtr: UnsafeMutablePointer) -> Void in + vLL256Shift(selfPtr, a, resultPtr) + }) + } + return result + } + + public mutating func inplaceLeftShifted(_ a: UInt32) { + var selfCopy = self + withUnsafePointer(to: &selfCopy) { (selfPtr: UnsafePointer) -> Void in + withUnsafeMutablePointer(to: &self, { (resultPtr: UnsafeMutablePointer) -> Void in + vLL256Shift(selfPtr, a, resultPtr) + }) + } + } + + public func rightShifted(_ a: UInt32) -> U256 { + var result = U256() + var selfCopy = self + withUnsafePointer(to: &selfCopy) { (selfPtr: UnsafePointer) -> Void in + withUnsafeMutablePointer(to: &result, { (resultPtr: UnsafeMutablePointer) -> Void in + vLR256Shift(selfPtr, a, resultPtr) + }) + } + return result + } + + public mutating func inplaceRightShifted(_ a: UInt32) { + var selfCopy = self + withUnsafePointer(to: &selfCopy) { (selfPtr: UnsafePointer) -> Void in + withUnsafeMutablePointer(to: &self, { (resultPtr: UnsafeMutablePointer) -> Void in + vLR256Shift(selfPtr, a, resultPtr) + }) + } + } + + public static func >> (lhs: U256, rhs: UInt32) -> U256 { + return lhs.rightShifted(rhs) + } + + public static func << (lhs: U256, rhs: UInt32) -> U256 { + return lhs.leftShifted(rhs) + } + +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Comparable.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Comparable.swift new file mode 100644 index 0000000..1a4a3e8 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Comparable.swift @@ -0,0 +1,30 @@ +// +// U256+Comparable.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: Comparable { + public static func < (lhs: U256, rhs: U256) -> Bool { + if lhs.v.1 < rhs.v.1 { + return true + } else if lhs.v.1 > rhs.v.1 { + return false + } + if lhs.v.0 < rhs.v.0 { + return true + } + return false + } +} + +extension U256: EvenOrOdd { + public var isEven: Bool { + return self.v.0.isEven + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Div.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Div.swift new file mode 100644 index 0000000..94750dc --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Div.swift @@ -0,0 +1,21 @@ +// +// U256+Div.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256 { + public func div(_ a: U256) -> (U256, U256) { + var result = U256() + var remainder = U256() + var aCopy = a + var selfCopy = self + vU256Divide(&selfCopy, &aCopy, &result, &remainder) + return (result, remainder) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Equatable.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Equatable.swift new file mode 100644 index 0000000..8fe7163 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Equatable.swift @@ -0,0 +1,17 @@ +// +// U256+Equitable.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: Equatable { + public static func == (lhs: U256, rhs: U256) -> Bool { + return lhs.v.0 == rhs.v.0 && + lhs.v.1 == rhs.v.1 + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Mod.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Mod.swift new file mode 100644 index 0000000..301a5ed --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Mod.swift @@ -0,0 +1,84 @@ +// +// U256+Mod.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: ModReducable { + public func mod(_ modulus: U256) -> U256 { + var result = U256() + var modCopy = modulus + var selfCopy = self + vU256Mod(&selfCopy, &modCopy, &result) + return result + } + + public mutating func inplaceMod(_ modulus: U256) { + var modCopy = modulus + var selfCopy = self + vU256Mod(&selfCopy, &modCopy, &self) + } + + public func modInv(_ modulus: U256) -> U256 { + var a = self + var new = U256.one + var old = U256.zero + var q = modulus + var r = U256.zero + var h = U256.zero + var positive = false + while !a.isZero { + (q, r) = q.div(a) + h = q.halfMul(new).addMod(old) + old = new + new = h + q = a + a = r + positive = !positive + } + if positive { + return old + } else { + return modulus.subMod(old) + } + } + + public func modMultiply(_ a: U256, _ modulus: U256) -> U256 { + var result = U512() + var aCopy = a + var selfCopy = self + vU256FullMultiply(&selfCopy, &aCopy, &result) + var extendedModulus = U512(v: (modulus.v.0, modulus.v.1, vUInt32(0), vUInt32(0))) + var extendedRes = U512() + vU512Mod(&result, &extendedModulus, &extendedRes) + let (_, bottom) = extendedRes.split() + return bottom + } + + public func fullMultiply(_ a: U256) -> (U256, U256) { +// var result = U512() +// var aCopy = a +// var selfCopy = self +// vU256FullMultiply(&selfCopy, &aCopy, &result) + let result: U512 = self.fullMul(a) + return result.split() + } + +// public func modAdd(_ a: U256, _ modulus: U256) -> U256 { +// var result = U256() +// var aCopy = a +// var selfCopy = self +// vU256FullMultiply(&selfCopy, &aCopy, &result) +// var extendedModulus = U512(v: (modulus.v.0, modulus.v.1, vUInt32(0), vUInt32(0))) +// var extendedRes = U512() +// vU512Mod(&result, &extendedModulus, &extendedRes) +// let (_, bottom) = extendedRes.split() +// return bottom +// } + +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Mont.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Mont.swift new file mode 100644 index 0000000..a2576e3 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Mont.swift @@ -0,0 +1,79 @@ +// +// U256+Mont.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 30.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: MontArithmeticsCompatible { + + static var montR = U512(v: (vZERO, vZERO, vUInt32(1), vZERO)) + + public static func getMontParams(_ a: U256) -> (U256, U256, U256) { + let ONE = U256.one + let montR = U256.max.mod(a) + ONE + // Montgommery R params is 2^256 + var primeU512 = U512(v: (a.v.0, a.v.1, vZERO, vZERO)) + var montInvRfullWidth = U256.montR.modInv(primeU512) + var RmulRinvFullWidth = U512(v: (vZERO, vZERO, montInvRfullWidth.v.0, montInvRfullWidth.v.1)) // virtual multiply by hand + var subtracted = U512() + var u512One = U512.one + vU512Sub(&RmulRinvFullWidth, &u512One, &subtracted) + var montKfullWidth = U512() + var remainder = U512() + vU512Divide(&subtracted, &primeU512, &montKfullWidth, &remainder) + let (_, montInvR) = montInvRfullWidth.split() + let (_, montK) = montKfullWidth.split() + return (montR, montInvR, montK) + } + + public func toMontForm(_ modulus: U256) -> U256 { + var multipliedByR = U512(v: (vZERO, vZERO, self.v.0, self.v.1)) // trivial bitshift + var paddedModulus = U512(v: (modulus.v.0, modulus.v.1, vZERO, vZERO)) + var remainder = U512() + vU512Mod(&multipliedByR, &paddedModulus, &remainder) + let (_, b) = remainder.split() + return b + } + + public func montMul(_ b: U256, modulus: U256, montR: U256, montInvR: U256, montK: U256) -> U256 { + + // x=a¯b¯. + // + // s=(xk mod r). + // + // t=x+sn. + // + // u=t/r. + // + // c¯=if (u U512 { + var result = U512() + var aCopy = a + var selfCopy = self + vU256FullMultiply(&selfCopy, &aCopy, &result) + return result + } + + public func halfMul(_ a: U256) -> U256 { + var result = U256() + var aCopy = a + var selfCopy = self + vU256HalfMultiply(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceHalfMul(_ a: U256) { + var aCopy = a + var selfCopy = self + vU256HalfMultiply(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Numeric.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Numeric.swift new file mode 100644 index 0000000..7af8a1d --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Numeric.swift @@ -0,0 +1,60 @@ +// +// U256+Numeric.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256: Numeric { + public typealias IntegerLiteralType = UInt64 + + public init(integerLiteral: U256.IntegerLiteralType) { + let top = integerLiteral >> 32 + let bot = integerLiteral & 0xffffffff + let u256 = U256(v: (vUInt32(x: UInt32(bot), y: UInt32(top), z: 0, w: 0), vZERO)) + self = u256 + } + + + public typealias Magnitude = U256 + public var magnitude: U256 { + return self + } + + public init?(exactly: T) { + return nil + } + public static var bitWidth: Int = U256bitLength + public static var max: U256 = U256MAX + public static var min: U256 = U256MIN + + + public static func * (lhs: U256, rhs: U256) -> U256 { + let (_, bottom) = lhs.fullMultiply(rhs) + return bottom + } + + public static func *= (lhs: inout U256, rhs: U256) { + lhs.inplaceHalfMul(rhs) + } + + public static func + (lhs: U256, rhs: U256) -> U256 { + return lhs.addMod(rhs) + } + + public static func += (lhs: inout U256, rhs: U256) { + lhs.inplaceAddMod(rhs) + } + + public static func - (lhs: U256, rhs: U256) -> U256 { + return lhs.subMod(rhs) + } + + public static func -= (lhs: inout U256, rhs: U256) { + lhs.inplaceSubMod(rhs) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256+Sub.swift b/EllipticSwift/FixedWidthTypes/U256/U256+Sub.swift new file mode 100644 index 0000000..1201c83 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256+Sub.swift @@ -0,0 +1,26 @@ +// +// U256+Sub.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U256 { + public func subMod(_ a: U256) -> U256 { + var result = U256() + var aCopy = a + var selfCopy = self + vU256Sub(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceSubMod(_ a: U256) { + var aCopy = a + var selfCopy = self + vU256Sub(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U256/U256.swift b/EllipticSwift/FixedWidthTypes/U256/U256.swift new file mode 100644 index 0000000..c0de58e --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U256/U256.swift @@ -0,0 +1,69 @@ +// +// U128.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 12.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +public var U256bitLength = 256 +public var U256byteLength = 32 +public var U256words = 8 +public var U256vectors = 2 +public var U256MAX = U256(Data(repeating: 255, count: U256byteLength))! +public var U256MIN = U256(Data(repeating: 0, count: U256byteLength))! + +extension U256: BytesInitializable, BytesRepresentable { + + public init?(_ bytes: Data) { + if bytes.count <= U256byteLength { + let padding = Data(repeating: 0, count: U256byteLength - bytes.count) + var fullData = (padding + bytes).bytes + let top = U128(Data(fullData[0 ..< U128byteLength]))! + let bottom = U128(Data(fullData[U128byteLength ..< U256byteLength]))! + self = vU256(v: (bottom.v, top.v)) + } else { + return nil + } + } + + public var bytes: Data { + return self.v.1.bigEndianBytes + self.v.0.bigEndianBytes + } + + public func memoryStructure() -> [UInt32] { + let vecs = self.v + var arr = [UInt32]() + arr.append(vecs.0.x) + arr.append(vecs.0.y) + arr.append(vecs.0.z) + arr.append(vecs.0.w) + arr.append(vecs.1.x) + arr.append(vecs.1.y) + arr.append(vecs.1.z) + arr.append(vecs.1.w) + return arr + } + + public func split() -> (U128, U128) { + return (U128(v: self.v.1), U128(v: self.v.0)) + } + + public var isZero: Bool { + return self.v.0.isZero && self.v.1.isZero + } +} + +extension U256: UInt64Initializable { + public init(_ value: UInt64) { + let top = value >> 32 + let bot = value & 0xffffffff + let u256 = U256(v: (vUInt32(x: UInt32(bot), y: UInt32(top), z: 0, w: 0), vZERO)) + self = u256 + } +} + + diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Add.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Add.swift new file mode 100644 index 0000000..8a6ac36 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Add.swift @@ -0,0 +1,26 @@ +// +// U512+Add.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 01.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public func addMod(_ a: U512) -> U512 { + var result = U512() + var aCopy = a + var selfCopy = self + vU512Add(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceAddMod(_ a: U512) { + var aCopy = a + var selfCopy = self + vU512Add(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Aux.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Aux.swift new file mode 100644 index 0000000..ebf0122 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Aux.swift @@ -0,0 +1,20 @@ +// +// U512+Aux.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 30.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public static var one: U512 { + return vU512(v: (vUInt32(1), vUInt32(0), vUInt32(0), vUInt32(0))) + } + + public static var zero: U512 { + return vU512(v: (vZERO, vZERO, vZERO, vZERO)) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Div.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Div.swift new file mode 100644 index 0000000..9bfd8fd --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Div.swift @@ -0,0 +1,21 @@ +// +// U512+Div.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 01.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public func div(_ a: U512) -> (U512, U512) { + var result = U512() + var remainder = U512() + var aCopy = a + var selfCopy = self + vU512Divide(&selfCopy, &aCopy, &result, &remainder) + return (result, remainder) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Mod.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Mod.swift new file mode 100644 index 0000000..e9d9ca9 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Mod.swift @@ -0,0 +1,36 @@ +// +// U512+Mod.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 01.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public func modInv(_ modulus: U512) -> U512 { + var a = self + var new = U512.one + var old = U512.zero + var q = modulus + var r = U512.zero + var h = U512.zero + var positive = false + while !a.isZero { + (q, r) = q.div(a) + h = q.halfMul(new).addMod(old) + old = new + new = h + q = a + a = r + positive = !positive + } + if positive { + return old + } else { + return modulus.subMod(old) + } + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Mul.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Mul.swift new file mode 100644 index 0000000..e345188 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Mul.swift @@ -0,0 +1,34 @@ +// +// U512+Mul.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 01.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public func fullMul(_ a: U512) -> U1024 { + var result = U1024() + var aCopy = a + var selfCopy = self + vU512FullMultiply(&selfCopy, &aCopy, &result) + return result + } + + public func halfMul(_ a: U512) -> U512 { + var result = U512() + var aCopy = a + var selfCopy = self + vU512HalfMultiply(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceHalfMul(_ a: U512) { + var aCopy = a + var selfCopy = self + vU512HalfMultiply(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512+Sub.swift b/EllipticSwift/FixedWidthTypes/U512/U512+Sub.swift new file mode 100644 index 0000000..701d9a1 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512+Sub.swift @@ -0,0 +1,26 @@ +// +// U512+Sub.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 01.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +extension U512 { + public func subMod(_ a: U512) -> U512 { + var result = U512() + var aCopy = a + var selfCopy = self + vU512Sub(&selfCopy, &aCopy, &result) + return result + } + + public mutating func inplaceSubMod(_ a: U512) { + var aCopy = a + var selfCopy = self + vU512Sub(&selfCopy, &aCopy, &self) + } +} diff --git a/EllipticSwift/FixedWidthTypes/U512/U512.swift b/EllipticSwift/FixedWidthTypes/U512/U512.swift new file mode 100644 index 0000000..c69accf --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/U512/U512.swift @@ -0,0 +1,66 @@ +// +// U512.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 13.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +public var U512bitLength = 512 +public var U512byteLength = 64 + +extension U512 { + public init?(_ bytes: Data) { + if bytes.count <= U512byteLength { + let padding = Data(repeating: 0, count: U512byteLength - bytes.count) + var fullData = (padding + bytes).bytes + let v3 = U128(Data(fullData[0 ..< U128byteLength]))! + let v2 = U128(Data(fullData[U128byteLength ..< U128byteLength*2]))! + let v1 = U128(Data(fullData[U128byteLength*2 ..< U128byteLength*3]))! + let v0 = U128(Data(fullData[U128byteLength*3 ..< U512byteLength]))! + self = vU512(v: (v0.v, v1.v, v2.v, v3.v)) + } else { + return nil + } + } + + public var bytes: Data { + return self.v.3.bigEndianBytes + self.v.2.bigEndianBytes + self.v.1.bigEndianBytes + self.v.0.bigEndianBytes + } + + public func split() -> (U256, U256) { + let vs = self.v + let top = U256(v: (vs.2, vs.3)) + let bottom = U256(v: (vs.0, vs.1)) + return (top, bottom) + } + + public func memoryStructure() -> [UInt32] { + let vecs = self.v + var arr = [UInt32]() + arr.append(vecs.0.x) + arr.append(vecs.0.y) + arr.append(vecs.0.z) + arr.append(vecs.0.w) + arr.append(vecs.1.x) + arr.append(vecs.1.y) + arr.append(vecs.1.z) + arr.append(vecs.1.w) + arr.append(vecs.2.x) + arr.append(vecs.2.y) + arr.append(vecs.2.z) + arr.append(vecs.2.w) + arr.append(vecs.3.x) + arr.append(vecs.3.y) + arr.append(vecs.3.z) + arr.append(vecs.3.w) + return arr + } + + public var isZero: Bool { + return self.v.0.isZero && self.v.1.isZero && self.v.2.isZero && self.v.3.isZero + } +} diff --git a/EllipticSwift/FixedWidthTypes/UInt32.swift b/EllipticSwift/FixedWidthTypes/UInt32.swift new file mode 100644 index 0000000..9d19d4e --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/UInt32.swift @@ -0,0 +1,37 @@ +// +// UInt32.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 14.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation + +extension UInt32 { + public var bigEndianBytes: Data { + var selfCopy = self.bigEndian + var data = Data(repeating: 0, count: 4) + withUnsafePointer(to: &selfCopy) { (p) -> Void in + p.withMemoryRebound(to: UInt8.self, capacity: 4, { (ptr) -> Void in + for i in 0 ..< 4 { + data[i] = ptr.advanced(by: i).pointee + } + }) + } + return data + } + + public var littleEndianBytes: Data { + var selfCopy = self.littleEndian + var data = Data(repeating: 0, count: 4) + withUnsafePointer(to: &selfCopy) { (p) -> Void in + p.withMemoryRebound(to: UInt8.self, capacity: 4, { (ptr) -> Void in + for i in 0 ..< 4 { + data[i] = ptr.advanced(by: i).pointee + } + }) + } + return data + } +} diff --git a/EllipticSwift/FixedWidthTypes/vUInt32.swift b/EllipticSwift/FixedWidthTypes/vUInt32.swift new file mode 100644 index 0000000..38f95a2 --- /dev/null +++ b/EllipticSwift/FixedWidthTypes/vUInt32.swift @@ -0,0 +1,102 @@ +// +// vUInt32.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 14.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation +import Accelerate + +public var vZERO: vUInt32 = vUInt32(0) + +extension vUInt32 { + public var isZero: Bool { + return self.x == 0 && self.y == 0 && self.z == 0 && self.w == 0 + } + + public init(_ value: UInt32) { + self = vUInt32(x: value, y: 0, z: 0, w: 0) + } + + public var bigEndianBytes: Data { + return self.w.bigEndianBytes + self.z.bigEndianBytes + self.y.bigEndianBytes + self.x.bigEndianBytes + } + + public var clippedValue: UInt64 { + var res = UInt64(self.x) + res += UInt64(self.y) << 32 + return res + } +} + +extension vUInt32: Zeroable { + public static var zero: vUInt32 { + return vUInt32() + } +} + +extension vUInt32: EvenOrOdd { + public var isEven: Bool { + return self.x & UInt32(1) == UInt32(0) + } +} + +extension vUInt32: Comparable { + public static func < (lhs: vUInt32, rhs: vUInt32) -> Bool { + if lhs.w > rhs.w { + return false + } else if lhs.w < rhs.w { + return true + } + if lhs.z > rhs.z { + return false + } else if lhs.z < rhs.z { + return true + } + if lhs.y > rhs.y { + return false + } else if lhs.y < rhs.y { + return true + } + if lhs.x > rhs.x { + return false + } else if lhs.x < rhs.x { + return true + } + return false + } +} + +extension vUInt32: BitAccessible { + public func bit(_ i: Int) -> Bool { + if i < 0 { + return false + } else if i < 32 { + return self.x & (UInt32(1) << i) != 0 + } else if i < 64 { + return self.y & (UInt32(1) << (i-32)) != 0 + } else if i < 96 { + return self.z & (UInt32(1) << (i-64)) != 0 + } else if i < 128 { + return self.w & (UInt32(1) << (i-96)) != 0 + } + return false + } +} + +extension vUInt32 { + public var leadingZeroBitCount: Int { + if self.w.leadingZeroBitCount != 32 { + return self.w.leadingZeroBitCount + } else if self.z.leadingZeroBitCount != 32 { + return 32 + self.z.leadingZeroBitCount + } else if self.y.leadingZeroBitCount != 32 { + return 64 + self.y.leadingZeroBitCount + } else if self.x.leadingZeroBitCount != 32 { + return 96 + self.x.leadingZeroBitCount + } + return 128 + } +} diff --git a/EllipticSwift/Info.plist b/EllipticSwift/Info.plist new file mode 100644 index 0000000..ee04bad --- /dev/null +++ b/EllipticSwift/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSHumanReadableCopyright + Copyright © 2018 Alexander Vlasov. All rights reserved. + NSPrincipalClass + + + diff --git a/EllipticSwift/WindowMethods/Constants.swift b/EllipticSwift/WindowMethods/Constants.swift new file mode 100644 index 0000000..4171a79 --- /dev/null +++ b/EllipticSwift/WindowMethods/Constants.swift @@ -0,0 +1,12 @@ +// +// Constants.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 09.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation + +public var DefaultWindowSize = 5 + diff --git a/EllipticSwift/WindowMethods/windowMethods.swift b/EllipticSwift/WindowMethods/windowMethods.swift new file mode 100644 index 0000000..d01336e --- /dev/null +++ b/EllipticSwift/WindowMethods/windowMethods.swift @@ -0,0 +1,138 @@ +// +// KSlidingWindow.swift +// EllipticSwift +// +// Created by Alexander Vlasov on 10.07.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import Foundation + +// returns [Int] - lookup coefficients in precompute, stores as SIGNED +public func computeWNAF(scalar: T, windowSize: Int = DefaultWindowSize) -> [Int] { + var result = [Int]() + result.reserveCapacity(100) + var coeffsIndex: Int = 0 // points to array of NAF coefficients. + func guardedMods(_ a: UInt32, _ half: Int, _ full: Int) -> Int { + precondition(full <= UInt32.max) + if a > half { + return full - Int(a) + } else { + return Int(a) + } + } + var dCoeffs = [Int]() + var i = 0 + var scalarCopy = scalar + let maxBit = windowSize - 1 + let half = 1 << (windowSize-1) + let full = 1 << windowSize + while scalarCopy > 0 { + if !scalarCopy.isEven { + let data = scalarCopy.bytes.bytes + let coeff = bits(data, maxBit, 0) // should be window size long + let mods = guardedMods(coeff, half, full) + dCoeffs.append(mods) + if mods > 0 { + scalarCopy = scalarCopy - T(UInt64(mods)) + } else { + scalarCopy = scalarCopy + T(UInt64(-mods)) + } +// scalarCopy = scalarCopy >> UInt32(windowSize) + scalarCopy = scalarCopy >> UInt32(1) + } else { + dCoeffs.append(0) + scalarCopy = scalarCopy >> UInt32(1) + } + i = i + 1 + } + return dCoeffs +} + +// returns [Int] - lookup coefficients in precompute, [BigUInt] - powers to rise the result +// lookup == -1 -> Just rise in a power +public func computeSlidingWindow (scalar: T, windowSize: Int = DefaultWindowSize) -> ([Int], [UInt64]){ + // compute left to right + let numElements = (scalar.bitWidth - 1) / windowSize + 1 + var lookupCoeffs = [Int]() + lookupCoeffs.reserveCapacity(numElements) + var powers = [UInt64]() + powers.reserveCapacity(numElements) + let data = scalar.bytes.bytes + var i = scalar.bitWidth - 1 + while i > 0 { + if !scalar.bit(i) { + lookupCoeffs.append(-1) + powers.append(2) + i = i - 1 + } else { + var l = i - windowSize + 1 + var nextI = l - 1 + if l <= 0 { + l = 0 + nextI = 0 + } + var bitSlice = bits(data, i, l) + let sliceBitWidth = i - l + 1 + let elementNumber = Int(bitSlice) - 1 + if bitSlice == 0 { + i = nextI + continue + } + while bitSlice & 1 == 0 { + bitSlice = bitSlice >> 1 + l = l + 1 + } + var power = UInt64(1) << windowSize + if windowSize > sliceBitWidth { + power = UInt64(1) << sliceBitWidth + } + lookupCoeffs.append(elementNumber) + powers.append(power) + i = nextI + } + } + return (lookupCoeffs, powers) +} + +internal func bits(_ beData: [UInt8], _ from: Int, _ to: Int) -> UInt32 { + // TODO: should improve to one pass + let numBytes = beData.count + precondition(to < beData.count * 8, "accessing out of range bits") + precondition(from > to, "should access nonzero range with LE notation") + precondition(to - from < UInt32.bitWidth, "not meant to access more than " + String(UInt32.bitWidth) + " bits") + var (upperByteNumber, upperBitInByte) = from.quotientAndRemainder(dividingBy: 8) + var (lowerByteNumber, lowerBitInByte) = to.quotientAndRemainder(dividingBy: 8) + upperByteNumber = numBytes - upperByteNumber - 1 + lowerByteNumber = numBytes - lowerByteNumber - 1 + if upperByteNumber == lowerByteNumber { + precondition(upperBitInByte <= 7) + var bitmask: UInt8 = UInt8((UInt16(1) << (upperBitInByte - lowerBitInByte + 1)) - UInt16(1)) + bitmask = bitmask << lowerBitInByte + let byte = beData[lowerByteNumber] + let maskedValue = byte & bitmask + let result = UInt32(maskedValue >> lowerBitInByte) + return result + } else { + let bitsFromUpperByte = upperBitInByte + 1 + let upperByteBitmask: UInt8 = UInt8((UInt16(1) << bitsFromUpperByte) - UInt16(1)) + let upperByte = beData[upperByteNumber] + let upperBits = (upperByte & upperByteBitmask) + + let bitsFromLowerByte = 8 - lowerBitInByte + var lowerByteBitmask: UInt8 = UInt8((UInt16(1) << bitsFromLowerByte) - UInt16(1)) + lowerByteBitmask = lowerByteBitmask << lowerBitInByte + let lowerByte = beData[lowerByteNumber] + let lowerBits = (lowerByte & lowerByteBitmask) >> lowerBitInByte + + var fullBits = UInt32(lowerBits) + var shiftMultiplier = 0 + for i in (upperByteNumber+1) ..< lowerByteNumber { + fullBits |= UInt32(beData[i]) << (shiftMultiplier*8 + lowerBitInByte) + shiftMultiplier = shiftMultiplier + 1 + } + fullBits |= UInt32(upperBits) << (shiftMultiplier*8 + bitsFromLowerByte) + return fullBits + } + +} diff --git a/EllipticSwiftTests/EllipticSwiftTests.swift b/EllipticSwiftTests/EllipticSwiftTests.swift new file mode 100644 index 0000000..a0da049 --- /dev/null +++ b/EllipticSwiftTests/EllipticSwiftTests.swift @@ -0,0 +1,516 @@ +// +// EllipticSwiftTests.swift +// EllipticSwiftTests +// +// Created by Alexander Vlasov on 07.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +import XCTest +import BigInt + +@testable import EllipticSwift +class EllipticSwiftTests: XCTestCase { + + func testBIimport() { + let a = BigUInt(3) + let b = BigUInt(97) + let c = a.inverse(b) + XCTAssert(c != nil) + } + + func testPointDoublingAndMultiplication() { + let c = EllipticSwift.secp256k1Curve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + let dbl = c.double(p!.toProjective()).toAffine().coordinates + let mul = c.mul(2, p!).toAffine().coordinates + XCTAssert(!dbl.isInfinity) + XCTAssert(!mul.isInfinity) + XCTAssert(dbl.X == mul.X) + XCTAssert(dbl.Y == mul.Y) + } + + func testPointConversionCycle() { + let c = EllipticSwift.secp256k1Curve + let x = BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)! + let y = BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)! + let p = c.toPoint(x, y) + XCTAssert(p != nil) + let proj = p!.toProjective() + let backToAffine = proj.toAffine().coordinates + XCTAssert(backToAffine.X == x) + XCTAssert(backToAffine.Y == y) + } + + func testPointAddition() { + let c = EllipticSwift.secp256k1Curve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + let q = c.toPoint(BigUInt("a1904a2f1366086462462b759857ee4ec785343d9e9c64f980527a9b62651e31", radix: 16)!, BigUInt("3e0e62a6dd89b0775092c1552751c35cf0769b4b2647ce6491e88dbff1c692ce", radix: 16)!) + XCTAssert(q != nil) + let sum = c.add(p!.toProjective(), q!.toProjective()) + let sumAffine = sum.toAffine().coordinates + XCTAssert(!sumAffine.isInfinity) + XCTAssert(sumAffine.X == BigUInt("cb48b4b3237451109ddd2fb9146556f4c1acb4082a9c667adf4fcb9b0bb6ff83", radix: 16)!) + XCTAssert(sumAffine.Y == BigUInt("b47df17dfc7607880c54f2c2bfea0f0118c79319573dc66fcb0d952115beb554", radix: 16)!) + } + + func testPointDouble() { + let c = EllipticSwift.secp256k1Curve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + let dbl = c.add(p!.toProjective(), p!.toProjective()) + let affine = dbl.toAffine().coordinates + XCTAssert(!affine.isInfinity) + XCTAssert(affine.X == BigUInt("aad76204cd11092a84f04694138db345b1d7223a0bba5483cd089968a34448cb", radix: 16)!) + XCTAssert(affine.Y == BigUInt("7cfb0467e5df4e174c1ee43c5dcca494cd3e198cf9512f7088bea0a8a76f7d78", radix: 16)!) + } + + func testPointMul() { + let scalar = BigUInt("e853ff4cc88e32bc6c2b74ffaca14a7e4b118686e77eefb086cb0ae298811127", radix: 16)! + let c = EllipticSwift.secp256k1Curve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + let res = c.mul(U256(scalar.serialize())!, p!) + let resAff = res.toAffine().coordinates + XCTAssert(!resAff.isInfinity) + XCTAssert(resAff.X == BigUInt("e2b1976566023f61f70893549a497dbf68f14e6cb44ba1b3bbe8c438a172a7b0", radix: 16)!) + XCTAssert(resAff.Y == BigUInt("d088864d26ac7c96690ebc652b2906e8f2b85bccfb27b181d587899ccab4b442", radix: 16)!) + } + + func testLargeFieldInv() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + for i in 0 ..< 10 { + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let trivialRes = ar.inverse(secp256k1PrimeBUI)! + let res = a.inv() + XCTAssert(res.value == trivialRes, "Failed on attempt = " + String(i)) + } + } + + func testLargeFieldMul() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + for i in 0 ..< 10 { + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let b = GeneralizedPrimeFieldElement.fromBytes(br.serialize(), field: secp256k1PrimeField) + let fullTrivialMul = ar * br + let pTrivial = fullTrivialMul % secp256k1PrimeBUI + let p = a * b + XCTAssert(p.value == pTrivial, "Failed on attempt = " + String(i)) + } + } + + func testLargeFieldAddition() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + for i in 0 ..< 10 { + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let b = GeneralizedPrimeFieldElement.fromBytes(br.serialize(), field: secp256k1PrimeField) + let fullTrivialMul = ar + br + let pTrivial = fullTrivialMul % secp256k1PrimeBUI + let p = a + b + XCTAssert(p.value == pTrivial, "Failed on attempt = " + String(i)) + } + } + + func testLargeFieldPow() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + for i in 0 ..< 10 { + let base = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let power = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let pTrivial = base.power(power, modulus: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(base.serialize(), field: secp256k1PrimeField) + let p = a.pow(U256(power.serialize())!) + XCTAssert(p.value == pTrivial, "Failed on attempt = " + String(i)) + } + } + + func testFieldInversion() { + let modulus = BigUInt(97) + let inverse = BigUInt(3).inverse(modulus)! + let field = GeneralizedNaivePrimeField(modulus) + let fe1 = GeneralizedPrimeFieldElement.fromValue(UInt64(3), field: field) + let inv = fe1.inv() + XCTAssert(inverse == inv.value) + let mul = fe1 * inv + XCTAssert(mul.value == 1) + } + + func testMontFieldConversion() { + let modulus = BigUInt(97) + let field = GeneralizedMontPrimeField(modulus) + let forward = GeneralizedPrimeFieldElement.fromValue(UInt64(3), field: field) + let back = forward.value + XCTAssert(back == 3) + let rawValue = U256(3) + let reduced = rawValue.toMontForm(U256(modulus.serialize())!) + XCTAssert(forward.rawValue == reduced) + } + + func testMontParamsCalculation() { + let modulus = BigUInt(97) + let field = GeneralizedMontPrimeField(modulus) + let R = BigUInt(1) << 256 + let montR = R % modulus + XCTAssert(montR == BigUInt(field.montR.bytes)) + let montInvR = montR.inverse(modulus)! + XCTAssert(montInvR == BigUInt(field.montInvR.bytes)) + let montK = (R * montInvR - BigUInt(1)) / modulus + XCTAssert(montK == BigUInt(field.montK.bytes)) + XCTAssert(BigUInt(field.montR.modMultiply(field.montInvR, field.prime).bytes) == 1) + } + +// func testMontReduction() { +// let modulus = BigUInt(97) +// let field = GeneralizedMontPrimeField(modulus) +// let R = BigUInt(1) << 256 +// let montR = R % modulus +// XCTAssert(montR == BigUInt(field.montR.bytes)) +// let montInvR = montR.inverse(modulus)! +// XCTAssert(montInvR == BigUInt(field.montInvR.bytes)) +// let montK = (R * montInvR - BigUInt(1)) / modulus +// XCTAssert(montK == BigUInt(field.montK.bytes)) +// +// let a = BigUInt.randomInteger(lessThan: modulus) +// let aReduced = (a * R) % modulus +// let fe = GeneralizedPrimeFieldElement.fromValue(a, field: field) +// XCTAssert(aReduced == BigUInt(fe.rawValue.bytes)) +// } + + func testMontMultiplication() { + let modulus = BigUInt(97) + let field = GeneralizedMontPrimeField(modulus) + let a = GeneralizedPrimeFieldElement.fromValue(UInt64(43), field: field) + let b = GeneralizedPrimeFieldElement.fromValue(UInt64(56), field: field) + let mul = a * b + let value = mul.value + XCTAssert(value == 80) + } + + func testModularSquareRoot() { + let bn256Prime = BigUInt("21888242871839275222246405745257275088696311157297823662689037894645226208583", radix: 10)! + let bn256PrimeField = GeneralizedNaivePrimeField(bn256Prime) + let primeField = bn256PrimeField + let x = BigUInt("16013846061302606236678105035458059333313648338706491832021059651102665958964", radix: 10)! + let xReduced = GeneralizedPrimeFieldElement.fromValue(x, field: primeField) + let sqrtReduced = xReduced.sqrt() + let y = sqrtReduced.value + // XCTAssert(sqrtReduced * sqrtReduced == xReduced) + // XCTAssert((y * y) % primeField.modulus == x) + XCTAssert(y == BigUInt("19775247992460679389771436516608933805782779220511590267128505960436574705663", radix: 10)!) + } + + func testNaiveModularMultiplicationPerformance() { + let bn256Prime = BigUInt("21888242871839275222246405745257275088696311157297823662689037894645226208583", radix: 10)! + let modulus = U256(bn256Prime.serialize())! + let number1 = BigUInt.randomInteger(lessThan: bn256Prime) + let number2 = BigUInt.randomInteger(lessThan: bn256Prime) + let bn1 = U256(number1.serialize())! + let bn2 = U256(number2.serialize())! + measure { + let _ = bn1.modMultiply(bn2, modulus) + } + } + + func testBitWidth() { + let br = BigUInt(11749) + let b = U256(br.serialize())! + let leadingZeroes = UInt32(11794).leadingZeroBitCount + let actualWidth = 32 - leadingZeroes + let bitWidth = b.bitWidth + let largeLeadingZeroes = b.leadingZeroBitCount + XCTAssert(largeLeadingZeroes + bitWidth == 256) + XCTAssert(actualWidth == bitWidth) + XCTAssert(leadingZeroes + 224 == largeLeadingZeroes) + } + + func testComputeSlidingWindow() { + let exponent = 12686028502 + let br = BigUInt(exponent) + let b = U256(br.serialize())! + let windowSize = 5 + let (lookups, powers) = computeSlidingWindow(scalar: b, windowSize: windowSize) + let numPrecomputedElements = (1 << windowSize) - 1 // 2**k - 1 + var precomputations = [Int](repeating: 0, count: numPrecomputedElements) + precomputations[0] = 1 + precomputations[1] = 2 + for i in 2 ..< numPrecomputedElements { + precomputations[i] = precomputations[i-2] + precomputations[1] + } + XCTAssert(lookups[0] != -1) + // base implementation of sliding windows exponentiation + var resultOrder = 0 + for i in 0 ..< lookups.count { + if lookups[i] == -1 { + resultOrder = resultOrder * 2 + } else { + let power = powers[i] + let intermediatePower = resultOrder * Int(power) + resultOrder = intermediatePower + precomputations[lookups[i]] + } + } + XCTAssert(resultOrder == exponent) + } + + func testDifferentSquaring() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt(2) + let b = U256(br.serialize())! + let mul = a * a + let trivial = a.field.doubleAndAddExponentiation(a.rawValue, b) + let sliding = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 5) + XCTAssert(mul.rawValue == trivial) + XCTAssert(trivial == sliding) + } + + func testDifferentCubing() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt(3) + let b = U256(br.serialize())! + var mul = a.field.mul(a.rawValue, a.rawValue) + mul = a.field.mul(a.rawValue, mul) + let trivial = a.field.doubleAndAddExponentiation(a.rawValue, b) + let sliding = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 5) + XCTAssert(mul == trivial) + XCTAssert(trivial == sliding) + } + + func testDifferentExponentiations() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(withExactWidth: 256) + let b = U256(br.serialize())! + let trivial = a.field.doubleAndAddExponentiation(a.rawValue, b) + let sliding = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 5) + XCTAssert(trivial == sliding) + } + + func testDoubleAndAddExponentiationPerformance() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.field.doubleAndAddExponentiation(a.rawValue, b) + } + } + + func testSlidingWindowExponentiationPerformance() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedNaivePrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 5) + } + } + + func testDoubleAndAddExponentiationPerformanceInMontForm() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedMontPrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.field.doubleAndAddExponentiation(a.rawValue, b) + } + } + + func testSlidingWindowExponentiationPerformanceInMontForm() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedMontPrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 5) + } + } + + func testWideSlidingWindowExponentiationPerformanceInMontForm() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedMontPrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.field.kSlidingWindowExponentiation(a.rawValue, b, windowSize: 16) + } + } + + func testNaviteModInverse() { + let modulus = U256(97) + let number = U256(3) + let inverse = number.modInv(modulus) + XCTAssert(inverse.v.0.clippedValue == 65) + } + + func testGenericFEInversion() { + let modulus = U256(97) + let field = GeneralizedMontPrimeField(modulus) + let fe = GeneralizedPrimeFieldElement.fromValue(UInt64(3), field: field) + let inverse = fe.inv() + let value = inverse.value + XCTAssert(value == 65) + } + + func testGenericFEMul() { + let modulus = U256(97) + let field = GeneralizedMontPrimeField(modulus) + let fe = GeneralizedPrimeFieldElement.fromValue(UInt64(3), field: field) + let mul = fe * fe + let value = mul.value + XCTAssert(value == 9) + } + + func testGenericFEMulWithOverflow() { + let modulus = U256(97) + let field = GeneralizedMontPrimeField(modulus) + let fe = GeneralizedPrimeFieldElement.fromValue(UInt64(40), field: field) + let mul = fe * fe + let value = mul.value + XCTAssert(value == 48) + } + + func testGenericDoubleAndAddExponentiationPerformanceInMontForm() { + let secp256k1Prime = EllipticSwift.secp256k1Prime + let secp256k1PrimeField = GeneralizedMontPrimeField(secp256k1Prime) + let ar = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let a = GeneralizedPrimeFieldElement.fromBytes(ar.serialize(), field: secp256k1PrimeField) + let br = BigUInt.randomInteger(lessThan: secp256k1PrimeBUI) + let b = U256(br.serialize())! + measure { + let _ = a.pow(b) + } + } + + func testGenericCurveCreation() { + let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! + // let secp256k1PrimeField = GeneralizedMontPrimeField.init(secp256k1PrimeBUI) + let secp256k1PrimeField = GeneralizedNaivePrimeField.init(secp256k1PrimeBUI) + let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! + let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! + let secp256k1WeierstrassCurve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = secp256k1WeierstrassCurve.testGenerator(AffineCoordinates(generatorX, generatorY)) + precondition(success, "Failed to init secp256k1 curve!") + } + + func testPointMulInGenerics() { + let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! + // let secp256k1PrimeField = GeneralizedMontPrimeField.init(secp256k1PrimeBUI) + let secp256k1PrimeField = GeneralizedNaivePrimeField.init(secp256k1PrimeBUI) + let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! + let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! + let secp256k1WeierstrassCurve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = secp256k1WeierstrassCurve.testGenerator(AffineCoordinates(generatorX, generatorY)) + XCTAssert(success, "Failed to init secp256k1 curve!") + + let scalar = BigUInt("e853ff4cc88e32bc6c2b74ffaca14a7e4b118686e77eefb086cb0ae298811127", radix: 16)! + let c = secp256k1WeierstrassCurve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + let res = c.mul(U256(scalar.serialize())! , p!) + let resAff = res.toAffine().coordinates + XCTAssert(!resAff.isInfinity) + XCTAssert(resAff.X == BigUInt("e2b1976566023f61f70893549a497dbf68f14e6cb44ba1b3bbe8c438a172a7b0", radix: 16)!) + XCTAssert(resAff.Y == BigUInt("d088864d26ac7c96690ebc652b2906e8f2b85bccfb27b181d587899ccab4b442", radix: 16)!) + } + + func testPointMulInGenericsInMontForm() { + let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! + let secp256k1PrimeField = GeneralizedMontPrimeField.init(secp256k1PrimeBUI) + // let secp256k1PrimeField = GeneralizedNaivePrimeField.init(secp256k1PrimeBUI) + let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! + let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! + let secp256k1WeierstrassCurve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = secp256k1WeierstrassCurve.testGenerator(AffineCoordinates(generatorX, generatorY)) + XCTAssert(success, "Failed to init secp256k1 curve!") + + let scalar = BigUInt("e853ff4cc88e32bc6c2b74ffaca14a7e4b118686e77eefb086cb0ae298811127", radix: 16)! + let c = secp256k1WeierstrassCurve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + var res = c.wNAFmul(U256(scalar.serialize())! , p!) + var resAff = res.toAffine().coordinates + XCTAssert(!resAff.isInfinity) + XCTAssert(resAff.X == BigUInt("e2b1976566023f61f70893549a497dbf68f14e6cb44ba1b3bbe8c438a172a7b0", radix: 16)!) + XCTAssert(resAff.Y == BigUInt("d088864d26ac7c96690ebc652b2906e8f2b85bccfb27b181d587899ccab4b442", radix: 16)!) + res = c.doubleAndAddMul(U256(scalar.serialize())! , p!) + resAff = res.toAffine().coordinates + XCTAssert(!resAff.isInfinity) + XCTAssert(resAff.X == BigUInt("e2b1976566023f61f70893549a497dbf68f14e6cb44ba1b3bbe8c438a172a7b0", radix: 16)!) + XCTAssert(resAff.Y == BigUInt("d088864d26ac7c96690ebc652b2906e8f2b85bccfb27b181d587899ccab4b442", radix: 16)!) + } + + func testPointMulPerformanceDoubleAndAdd() { + let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! + let secp256k1PrimeField = GeneralizedMontPrimeField.init(secp256k1PrimeBUI) + // let secp256k1PrimeField = GeneralizedNaivePrimeField.init(secp256k1PrimeBUI) + let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! + let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! + let secp256k1WeierstrassCurve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = secp256k1WeierstrassCurve.testGenerator(AffineCoordinates(generatorX, generatorY)) + XCTAssert(success, "Failed to init secp256k1 curve!") + + let scalar = BigUInt("e853ff4cc88e32bc6c2b74ffaca14a7e4b118686e77eefb086cb0ae298811127", radix: 16)! + let c = secp256k1WeierstrassCurve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + measure { + let _ = c.doubleAndAddMul(U256(scalar.serialize())! , p!) + } + } + + func testPointMulPerformanceWNAF() { + let secp256k1PrimeBUI = BigUInt("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", radix: 16)! + let secp256k1PrimeField = GeneralizedMontPrimeField.init(secp256k1PrimeBUI) + // let secp256k1PrimeField = GeneralizedNaivePrimeField.init(secp256k1PrimeBUI) + let secp256k1CurveOrderBUI = BigUInt("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", radix: 16)! + let secp256k1CurveOrder = U256(secp256k1CurveOrderBUI.serialize())! + let secp256k1WeierstrassCurve = GeneralizedWeierstrassCurve(field: secp256k1PrimeField, order: secp256k1CurveOrder, A: U256(0), B: U256(7)) + let generatorX = BigUInt("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", radix: 16)! + let generatorY = BigUInt("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", radix: 16)! + let success = secp256k1WeierstrassCurve.testGenerator(AffineCoordinates(generatorX, generatorY)) + XCTAssert(success, "Failed to init secp256k1 curve!") + + let scalar = BigUInt("e853ff4cc88e32bc6c2b74ffaca14a7e4b118686e77eefb086cb0ae298811127", radix: 16)! + let c = secp256k1WeierstrassCurve + let p = c.toPoint(BigUInt("5cfdf0eaa22d4d954067ab6f348e400f97357e2703821195131bfe78f7c92b38", radix: 16)!, BigUInt("584171d79868d22fae4442faede6d2c4972a35d1699453254d1b0df029225032", radix: 16)!) + XCTAssert(p != nil) + measure { + let _ = c.wNAFmul(U256(scalar.serialize())! , p!) + } + } +} diff --git a/EllipticSwiftTests/Info.plist b/EllipticSwiftTests/Info.plist new file mode 100644 index 0000000..6c40a6c --- /dev/null +++ b/EllipticSwiftTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/EllipticSwift_iOS/EllipticSwift_iOS.h b/EllipticSwift_iOS/EllipticSwift_iOS.h new file mode 100644 index 0000000..c499b8d --- /dev/null +++ b/EllipticSwift_iOS/EllipticSwift_iOS.h @@ -0,0 +1,19 @@ +// +// EllipticSwift_iOS.h +// EllipticSwift_iOS +// +// Created by Alexander Vlasov on 07.08.2018. +// Copyright © 2018 Alexander Vlasov. All rights reserved. +// + +#import + +//! Project version number for EllipticSwift_iOS. +FOUNDATION_EXPORT double EllipticSwift_iOSVersionNumber; + +//! Project version string for EllipticSwift_iOS. +FOUNDATION_EXPORT const unsigned char EllipticSwift_iOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + + diff --git a/EllipticSwift_iOS/Info.plist b/EllipticSwift_iOS/Info.plist new file mode 100644 index 0000000..1007fd9 --- /dev/null +++ b/EllipticSwift_iOS/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d49e6aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ +Copyright 2018 Alex Vlasov + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..5aad86e --- /dev/null +++ b/Podfile @@ -0,0 +1,22 @@ +def import_pods + pod 'BigInt', '~> 3.1' +end + +target 'EllipticSwift' do + platform :osx, '10.11' + use_frameworks! +# use_modular_headers! + import_pods + + target 'EllipticSwiftTests' do + inherit! :search_paths + # Pods for testing + end +end + +target 'EllipticSwift_iOS' do + platform :ios, '9.0' + use_frameworks! +# use_modular_headers! + import_pods +end diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..fec4fc2 --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,20 @@ +PODS: + - BigInt (3.1.0): + - SipHash (~> 1.2) + - SipHash (1.2.2) + +DEPENDENCIES: + - BigInt (~> 3.1) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - BigInt + - SipHash + +SPEC CHECKSUMS: + BigInt: 76b5dfdfa3e2e478d4ffdf161aeede5502e2742f + SipHash: fad90a4683e420c52ef28063063dbbce248ea6d4 + +PODFILE CHECKSUM: 597335c5c8e18cd37e92413d97d9dc943246349e + +COCOAPODS: 1.5.3 diff --git a/Pods/BigInt/LICENSE.md b/Pods/BigInt/LICENSE.md new file mode 100644 index 0000000..18cefd1 --- /dev/null +++ b/Pods/BigInt/LICENSE.md @@ -0,0 +1,20 @@ + +Copyright (c) 2016-2017 Károly Lőrentey + +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. diff --git a/Pods/BigInt/README.md b/Pods/BigInt/README.md new file mode 100644 index 0000000..0cf7f1c --- /dev/null +++ b/Pods/BigInt/README.md @@ -0,0 +1,435 @@ +[![BigInt](https://github.com/attaswift/BigInt/raw/master/images/banner.png)](https://github.com/attaswift/BigInt) + +* [Overview](#overview) +* [API Documentation](#api) +* [License](#license) +* [Requirements and Integration](#integration) +* [Implementation Notes](#notes) + * [Full-width multiplication and division primitives](#fullwidth) + * [Why is there no generic `BigInt` type?](#generics) +* [Calculation Samples](#samples) + * [Obligatory factorial demo](#factorial) + * [RSA Cryptography](#rsa) + * [Calculating the Digits of π](#pi) + +[![Swift 3](https://img.shields.io/badge/Swift-4-blue.svg)](https://developer.apple.com/swift/) +[![License](https://img.shields.io/badge/licence-MIT-blue.svg)](http://cocoapods.org/pods/BigInt) +[![Platform](https://img.shields.io/cocoapods/p/BigInt.svg)](http://cocoapods.org/pods/BigInt) + +[![Build Status](https://travis-ci.org/attaswift/BigInt.svg?branch=master)](https://travis-ci.org/attaswift/BigInt) +[![Code Coverage](https://codecov.io/github/attaswift/BigInt/coverage.svg?branch=master)](https://codecov.io/github/attaswift/BigInt?branch=master) +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) +[![Version](https://img.shields.io/cocoapods/v/BigInt.svg)](http://cocoapods.org/pods/BigInt) + +## Overview + +This repository provides [integer types of arbitrary width][wiki] implemented +in 100% pure Swift. The underlying representation is in base 2^64, using `Array`. + +[wiki]: https://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic + +This module is handy when you need an integer type that's wider than `UIntMax`, but +you don't want to add [The GNU Multiple Precision Arithmetic Library][GMP] +as a dependency. + +[GMP]: https://gmplib.org + +Two big integer types are included: [`BigUInt`][BigUInt] and [`BigInt`][BigInt], +the latter being the signed variant. +Both of these are Swift structs with copy-on-write value semantics, and they can be used much +like any other integer type. + +The library provides implementations for some of the most frequently useful functions on +big integers, including + +- All functionality from [`Comparable`][comparison] and [`Hashable`][hashing] + +- [The full set of arithmetic operators][addition]: `+`, `-`, `*`, `/`, `%`, `+=`, `-=`, `*=`, `/=`, `%=` + - [Addition][addition] and [subtraction][subtraction] have variants that allow for + shifting the digits of the second operand on the fly. + - Unsigned subtraction will trap when the result would be negative. + ([There are variants][subtraction] that return an overflow flag.) + - [Multiplication][mul] uses brute force for numbers up to 1024 digits, then switches to Karatsuba's recursive method. + (This limit is configurable, see `BigUInt.directMultiplicationLimit`.) + - A [fused multiply-add][fused] method is also available, along with other [special-case variants][multiplication]. + - [Division][division] uses Knuth's Algorithm D, with its 3/2 digits wide quotient approximation. + It will trap when the divisor is zero. + - [`BigUInt.divide`][divide] returns the quotient and + remainder at once; this is faster than calculating them separately. + +- [Bitwise operators][bitwise]: `~`, `|`, `&`, `^`, `|=`, `&=`, `^=`, plus the following read-only properties: + - [`width`][width]: the minimum number of bits required to store the integer, + - [`trailingZeroBitCount`][trailingZeroBitCount]: the number of trailing zero bits in the binary representation, + - [`leadingZeroBitCount`][leadingZeroBitCount]: the number of leading zero bits (when the last digit isn't full), + +- [Shift operators][shift]: `>>`, `<<`, `>>=`, `<<=` + +- Methods to [convert `NSData` to big integers][data] and vice versa. + +- Support for [generating random integers][random] of specified maximum width or magnitude. + +- Radix conversion to/from [`String`s][radix1] and [big integers][radix2] up to base 36 (using repeated divisions). + - Big integers use this to implement `StringLiteralConvertible` (in base 10). + +- [`sqrt(n)`][sqrt]: The square root of an integer (using Newton's method). + +- [`BigUInt.gcd(n, m)`][GCD]: The greatest common divisor of two integers (Stein's algorithm). + +- [`base.power(exponent, modulus)`][powmod]: Modular exponentiation (right-to-left binary method). + [Vanilla exponentiation][power] is also available. +- [`n.inverse(modulus)`][inverse]: Multiplicative inverse in modulo arithmetic (extended Euclidean algorithm). +- [`n.isPrime()`][prime]: Miller–Rabin primality test. + +The implementations are intended to be reasonably efficient, but they are unlikely to be +competitive with GMP at all, even when I happened to implement an algorithm with same asymptotic +behavior as GMP. (I haven't performed a comparison benchmark, though.) + +The library has 100% unit test coverage. Sadly this does not imply that there are no bugs +in it. + +## API Documentation + +Generated API docs are available at http://attaswift.github.io/BigInt/. + +## License + +BigInt can be used, distributed and modified under [the MIT license][license]. + +## Requirements and Integration + +BigInt 3.0.0 requires Swift 4. (The last version with support for Swift 3.x was BigInt 2.1.0. +The last version with support for Swift 2 was BigInt 1.3.0.) + +BigInt deploys to macOS 10.10, iOS 9, watchOS 2 and tvOS 9. +It has been tested on the latest OS releases only---however, as the module uses very few platform-provided APIs, +there should be very few issues with earlier versions. + +BigInt uses no APIs specific to Apple platforms except for `arc4random_buf` in `BigUInt Random.swift`, so +it should be easy to port it to other operating systems. + +Setup instructions: + +- **Swift Package Manager:** + Although the Package Manager is still in its infancy, BigInt provides experimental support for it. + Add this to the dependency section of your `Package.swift` manifest: + + ```Swift + .Package(url: "https://github.com/attaswift/BigInt.git", from: "3.1.0") + ``` + +- **CocoaPods:** Put this in your `Podfile`: + + ```Ruby + pod 'BigInt', '~> 3.1' + ``` + +- **Carthage:** Put this in your `Cartfile`: + + ``` + github "attaswift/BigInt" ~> 3.1 + ``` + + +## Implementation notes + +[`BigUInt`][BigUInt] is a `MutableCollectionType` of its 64-bit digits, with the least significant +digit at index 0. As a convenience, [`BigUInt`][BigUInt] allows you to subscript it with indexes at +or above its `count`. [The subscript operator][subscript] returns 0 for out-of-bound `get`s and +automatically extends the array on out-of-bound `set`s. This makes memory management simpler. + +[`BigInt`][BigInt] is just a tiny wrapper around a `BigUInt` [absolute value][abs] and a +[sign bit][negative], both of which are accessible as public read-write properties. + +### Full-width multiplication and division primitives + +I haven't found (64,64)->128 multiplication or (128,64)->64 division operations +in Swift, so [the module has generic implementations for them][fullmuldiv] in terms of the standard +single-width `*` and `/` operators. I suspect there are LLVM intrinsics for full-width +arithmetics that are probably accessible somehow, though. ([Let me know][twitter] if you know how!) + +This sounds slow, but 64-bit digits are +still considerably faster than 32-bit, even though the latter can use direct 64-bit arithmetic to +implement these primitives. + +### Why is there no generic `BigInt` type? + +The types provided by `BigInt` are not parametric—this is very much intentional, as +Swift generics cost us dearly at runtime in this use case. In every approach I tried, +making arbitrary-precision arithmetic operations work with a generic `Digit` type parameter +resulted in code that was literally *ten times slower*. If you can make the algorithms generic +without such a huge performance hit, [please enlighten me][twitter]! + +This is an area that I plan to investigate more, as it would be useful to have generic +implementations for arbitrary-width arithmetic operations. (Polynomial division and decimal bases +are two examples.) The library already implements double-digit multiplication and division as +extension methods on a protocol with an associated type requirement; this has not measurably affected +performance. Unfortunately, the same is not true for `BigUInt`'s methods. + +Of course, as a last resort, we could just duplicate the code to create a separate +generic variant that was slower but more flexible. + +[license]: https://github.com/attaswift/BigInt/blob/master/LICENSE.md +[twitter]: https://twitter.com/lorentey +[BigUInt]: http://attaswift.github.io/BigInt/Structs/BigUInt.html +[BigInt]: http://attaswift.github.io/BigInt/Structs/BigInt.html +[comparison]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Comparison +[hashing]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Hashing +[addition]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Addition +[subtraction]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Subtraction +[mul]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:ZFV6BigInt7BigUIntoi1mFTS0_S0__S0_ +[fused]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUInt14multiplyAndAddFTS0_Vs6UInt6410atPositionSi_T_ +[multiplication]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Multiplication +[division]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Division +[divide]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUInt7dividedFT2byS0__T8quotientS0_9remainderS0__ +[bitwise]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Bitwise%20Operations +[width]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:vV6BigInt7BigUInt5widthSi +[leadingZeroBitCount]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:vV6BigInt7BigUInt13leadingZeroBitCountSi +[trailingZeroBitCount]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:vV6BigInt7BigUInt14trailingZeroBitCountSi +[shift]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Shift%20Operators +[data]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/NSData%20Conversion +[random]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Random%20Integers +[radix1]: http://attaswift.github.io/BigInt/Extensions/String.html#/s:FE6BigIntSScFTVS_7BigUInt5radixSi9uppercaseSb_SS +[radix2]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUIntcFTSS5radixSi_GSqS0__ +[sqrt]: http://attaswift.github.io/BigInt/Functions.html#/s:F6BigInt4sqrtFVS_7BigUIntS0_ +[GCD]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:ZFV6BigInt7BigUInt3gcdFTS0_S0__S0_ +[powmod]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUInt5powerFTS0_7modulusS0__S0_ +[power]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUInt5powerFSiS0_ +[inverse]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/s:FV6BigInt7BigUInt7inverseFS0_GSqS0__ +[prime]: http://attaswift.github.io/BigInt/Structs/BigUInt.html#/Primality%20Testing +[abs]: http://attaswift.github.io/BigInt/Structs/BigInt.html#/s:vV6BigInt6BigInt3absVS_7BigUInt +[negative]: http://attaswift.github.io/BigInt/Structs/BigInt.html#/s:vV6BigInt6BigInt8negativeSb +[subscript]: https://github.com/attaswift/BigInt/blob/v2.0.0/Sources/BigUInt.swift#L216-L239 +[fullmuldiv]: https://github.com/attaswift/BigInt/blob/v2.0.0/Sources/BigDigit.swift#L96-L167 + + +## Calculation Samples + +### Obligatory Factorial Demo + +It is easy to use `BigInt` to calculate the factorial function for any integer: + +```Swift +import BigInt + +func factorial(_ n: Int) -> BigInt { + return (1 ... n).map { BigInt($0) }.reduce(BigInt(1), *) +} + +print(factorial(10)) +==> 362880 + +print(factorial(100)) +==> 93326215443944152681699238856266700490715968264381621468592963895217599993229915 + 6089414639761565182862536979208272237582511852109168640000000000000000000000 + +print(factorial(1000)) +==> 40238726007709377354370243392300398571937486421071463254379991042993851239862902 + 05920442084869694048004799886101971960586316668729948085589013238296699445909974 + 24504087073759918823627727188732519779505950995276120874975462497043601418278094 + 64649629105639388743788648733711918104582578364784997701247663288983595573543251 + 31853239584630755574091142624174743493475534286465766116677973966688202912073791 + 43853719588249808126867838374559731746136085379534524221586593201928090878297308 + 43139284440328123155861103697680135730421616874760967587134831202547858932076716 + 91324484262361314125087802080002616831510273418279777047846358681701643650241536 + 91398281264810213092761244896359928705114964975419909342221566832572080821333186 + 11681155361583654698404670897560290095053761647584772842188967964624494516076535 + 34081989013854424879849599533191017233555566021394503997362807501378376153071277 + 61926849034352625200015888535147331611702103968175921510907788019393178114194545 + 25722386554146106289218796022383897147608850627686296714667469756291123408243920 + 81601537808898939645182632436716167621791689097799119037540312746222899880051954 + 44414282012187361745992642956581746628302955570299024324153181617210465832036786 + 90611726015878352075151628422554026517048330422614397428693306169089796848259012 + 54583271682264580665267699586526822728070757813918581788896522081643483448259932 + 66043367660176999612831860788386150279465955131156552036093988180612138558600301 + 43569452722420634463179746059468257310379008402443243846565724501440282188525247 + 09351906209290231364932734975655139587205596542287497740114133469627154228458623 + 77387538230483865688976461927383814900140767310446640259899490222221765904339901 + 88601856652648506179970235619389701786004081188972991831102117122984590164192106 + 88843871218556461249607987229085192968193723886426148396573822911231250241866493 + 53143970137428531926649875337218940694281434118520158014123344828015051399694290 + 15348307764456909907315243327828826986460278986432113908350621709500259738986355 + 42771967428222487575867657523442202075736305694988250879689281627538488633969099 + 59826280956121450994871701244516461260379029309120889086942028510640182154399457 + 15680594187274899809425474217358240106367740459574178516082923013535808184009699 + 63725242305608559037006242712434169090041536901059339838357779394109700277534720 + 00000000000000000000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000000000000000000000000000 + 00000 +``` + +Well, I guess that's all right, but it's not very interesting. Let's try something more useful. + +### RSA Cryptography + +The `BigInt` module provides all necessary parts to implement an (overly) +simple [RSA cryptography system][RSA]. + +[RSA]: https://en.wikipedia.org/wiki/RSA_(cryptosystem) + +Let's start with a simple function that generates a random n-bit prime. The module +includes a function to generate random integers of a specific size, and also an +`isPrime` method that performs the Miller–Rabin primality test. These are all we need: + +```Swift +func generatePrime(_ width: Int) -> BigUInt { + while true { + var random = BigUInt.randomInteger(withExactWidth: width) + random |= BigUInt(1) + if random.isPrime() { + return random + } + } +} + +let p = generatePrime(1024) +==> 13308187650642192396256419911012544845370493728424936791561478318443071617242872 + 81980956747087187419914435169914161116601678883358611076800743580556055714173922 + 08406194264346635072293912609713085260354070700055888678514690878149253177960273 + 775659537560220378850112471985434373425534121373466492101182463962031 + +let q = generatePrime(1024) +==> 17072954422657145489547308812333368925007949054501204983863958355897172093173783 + 10108226596943999553784252564650624766276133157586733504784616138305701168410157 + 80784336308507083874651158029602582993233111593356512531869546706885170044355115 + 669728424124141763799008880327106952436883614887277350838425336156327 +``` + +Cool! Now that we have two large primes, we can produce an RSA public/private keypair +out of them. + +```Swift +typealias Key = (modulus: BigUInt, exponent: BigUInt) + +let n = p * q +==> 22721008120758282530010953362926306641542233757318103044313144976976529789946696 + 15454966720907712515917481418981591379647635391260569349099666410127279690367978 + 81184375533755888994370640857883754985364288413796100527262763202679037134021810 + 57933883525572232242690805678883227791774442041516929419640051653934584376704034 + 63953169772816907280591934423237977258358097846511079947337857778137177570668391 + 57455417707100275487770399281417352829897118140972240757708561027087217205975220 + 02207275447810167397968435583004676293892340103729490987263776871467057582629588 + 916498579594964478080508868267360515953225283461208420137 + +let e: BigUInt = 65537 +let phi = (p - 1) * (q - 1) +let d = e.inverse(phi)! // d * e % phi == 1 +==> 13964664343869014759736350480776837992604500903989703383202366291905558996277719 + 77822086142456362972689566985925179681282432115598451765899180050962461295573831 + 37069237934291884106584820998146965085531433195106686745474222222620986858696591 + 69836532468835154412554521152103642453158895363417640676611704542784576974374954 + 45789456921660619938185093118762690200980720312508614337759620606992462563490422 + 76669559556568917533268479190948959560397579572761529852891246283539604545691244 + 89999692877158676643042118662613875863504016129837099223040687512684532694527109 + 80742873307409704484365002175294665608486688146261327793 + +let publicKey: Key = (n, e) +let privateKey: Key = (n, d) +``` + +In RSA, modular exponentiation is used to encrypt (and decrypt) messages. + +```Swift +func encrypt(_ message: BigUInt, key: Key) -> BigUInt { + return message.power(key.exponent, modulus: key.modulus) +} +``` + +Let's try out our new keypair by converting a string into UTF-8, interpreting +the resulting binary representation as a big integer, and encrypting it with the +public key. `BigUInt` has an initializer that takes an `NSData`, so this is pretty +easy to do: + +```Swift +let secret: BigUInt = BigUInt("Arbitrary precision arithmetic is fun!".dataUsingEncoding(NSUTF8StringEncoding)!) +==> 83323446846105976078466731524728681905293067701804838925389198929123912971229457 + 68818568737 + +let cyphertext = encrypt(secret, key: publicKey) +==> 95186982543485985200666516508066093880038842892337880561554910904277290917831453 + 54854954722744805432145474047391353716305176389470779020645959135298322520888633 + 61674945129099575943384767330342554525120384485469428048962027149169876127890306 + 77028183904699491962050888974524603226290836984166164759586952419343589385279641 + 47999991283152843977988979846238236160274201261075188190509539751990119132013021 + 74866638595734222867005089157198503204192264814750832072844208520394603054901706 + 06024394731371973402595826456435944968439153664617188570808940022471990638468783 + 49208193955207336172861151720299024935127021719852700882 +``` + +Well, it looks encrypted all right, but can we get the original message back? +In theory, encrypting the cyphertext with the private key returns the original message. +Let's see: + +```Swift +let plaintext = encrypt(cyphertext, key: privateKey) +==> 83323446846105976078466731524728681905293067701804838925389198929123912971229457 + 68818568737 + +let received = String(data: plaintext.serialize(), encoding: NSUTF8StringEncoding) +==> "Arbitrary precision arithmetic is fun!" +``` + +Yay! This is truly terrific, but please don't use this example code in an actual +cryptography system. RSA has lots of subtle (and some not so subtle) complications +that we ignored to keep this example short. + +### Calculating the Digits of π + +Another fun activity to try with `BigInt`s is to generate the digits of π. +Let's try implementing [Jeremy Gibbon's spigot algorithm][spigot]. +This is a rather slow algorithm as π-generators go, but it makes up for it with its grooviness +factor: it's remarkably short, it only uses (big) integer arithmetic, and every iteration +produces a single new digit in the base-10 representation of π. This naturally leads to an +implementation as an infinite `GeneratorType`: + +[spigot]: http://www.cs.ox.ac.uk/jeremy.gibbons/publications/spigot.pdf + +```Swift +func digitsOfPi() -> AnyGenerator { + var q: BigUInt = 1 + var r: BigUInt = 180 + var t: BigUInt = 60 + var i: UInt64 = 2 // Does not overflow until digit #826_566_842 + return AnyIterator { + let u: UInt64 = 3 * (3 * i + 1) * (3 * i + 2) + let y = (q.multiplied(byDigit: 27 * i - 12) + 5 * r) / (5 * t) + (q, r, t) = ( + 10 * q.multiplied(byDigit: i * (2 * i - 1)), + 10 * (q.multiplied(byDigit: 5 * i - 2) + r - y * t).multiplied(byDigit: u), + t.multiplied(byDigit: u)) + i += 1 + return Int(y[0]) + } +} +``` + +Well, that was surprisingly easy. But does it work? Of course it does! + +```Swift +var digits = "π ≈ " +var count = 0 +for digit in digitsOfPi() { + assert(digit < 10) + digits += String(digit) + count += 1 + if count == 1 { digits += "." } + if count == 1000 { break } +} + +digits +==> π ≈ 3.14159265358979323846264338327950288419716939937510582097494459230781640628 + 62089986280348253421170679821480865132823066470938446095505822317253594081284811 + 17450284102701938521105559644622948954930381964428810975665933446128475648233786 + 78316527120190914564856692346034861045432664821339360726024914127372458700660631 + 55881748815209209628292540917153643678925903600113305305488204665213841469519415 + 11609433057270365759591953092186117381932611793105118548074462379962749567351885 + 75272489122793818301194912983367336244065664308602139494639522473719070217986094 + 37027705392171762931767523846748184676694051320005681271452635608277857713427577 + 89609173637178721468440901224953430146549585371050792279689258923542019956112129 + 02196086403441815981362977477130996051870721134999999837297804995105973173281609 + 63185950244594553469083026425223082533446850352619311881710100031378387528865875 + 33208381420617177669147303598253490428755468731159562863882353787593751957781857 + 780532171226806613001927876611195909216420198 +``` + +Now go and have some fun with big integers on your own! diff --git a/Pods/BigInt/sources/Addition.swift b/Pods/BigInt/sources/Addition.swift new file mode 100644 index 0000000..34f4d44 --- /dev/null +++ b/Pods/BigInt/sources/Addition.swift @@ -0,0 +1,126 @@ +// +// Addition.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + //MARK: Addition + + /// Add `word` to this integer in place. + /// `word` is shifted `shift` words to the left before being added. + /// + /// - Complexity: O(max(count, shift)) + internal mutating func addWord(_ word: Word, shiftedBy shift: Int = 0) { + precondition(shift >= 0) + var carry = word + var i = shift + while carry > 0 { + let (d, c) = self[i].addingReportingOverflow(carry) + self[i] = d + carry = (c ? 1 : 0) + i += 1 + } + } + + /// Add the digit `d` to this integer and return the result. + /// `d` is shifted `shift` words to the left before being added. + /// + /// - Complexity: O(max(count, shift)) + internal func addingWord(_ word: Word, shiftedBy shift: Int = 0) -> BigUInt { + var r = self + r.addWord(word, shiftedBy: shift) + return r + } + + /// Add `b` to this integer in place. + /// `b` is shifted `shift` words to the left before being added. + /// + /// - Complexity: O(max(count, b.count + shift)) + internal mutating func add(_ b: BigUInt, shiftedBy shift: Int = 0) { + precondition(shift >= 0) + var carry = false + var bi = 0 + let bc = b.count + while bi < bc || carry { + let ai = shift + bi + let (d, c) = self[ai].addingReportingOverflow(b[bi]) + if carry { + let (d2, c2) = d.addingReportingOverflow(1) + self[ai] = d2 + carry = c || c2 + } + else { + self[ai] = d + carry = c + } + bi += 1 + } + } + + /// Add `b` to this integer and return the result. + /// `b` is shifted `shift` words to the left before being added. + /// + /// - Complexity: O(max(count, b.count + shift)) + internal func adding(_ b: BigUInt, shiftedBy shift: Int = 0) -> BigUInt { + var r = self + r.add(b, shiftedBy: shift) + return r + } + + /// Increment this integer by one. If `shift` is non-zero, it selects + /// the word that is to be incremented. + /// + /// - Complexity: O(count + shift) + internal mutating func increment(shiftedBy shift: Int = 0) { + self.addWord(1, shiftedBy: shift) + } + + /// Add `a` and `b` together and return the result. + /// + /// - Complexity: O(max(a.count, b.count)) + public static func +(a: BigUInt, b: BigUInt) -> BigUInt { + return a.adding(b) + } + + /// Add `a` and `b` together, and store the sum in `a`. + /// + /// - Complexity: O(max(a.count, b.count)) + public static func +=(a: inout BigUInt, b: BigUInt) { + a.add(b, shiftedBy: 0) + } +} + +extension BigInt { + /// Add `a` to `b` and return the result. + public static func +(a: BigInt, b: BigInt) -> BigInt { + switch (a.sign, b.sign) { + case (.plus, .plus): + return BigInt(sign: .plus, magnitude: a.magnitude + b.magnitude) + case (.minus, .minus): + return BigInt(sign: .minus, magnitude: a.magnitude + b.magnitude) + case (.plus, .minus): + if a.magnitude >= b.magnitude { + return BigInt(sign: .plus, magnitude: a.magnitude - b.magnitude) + } + else { + return BigInt(sign: .minus, magnitude: b.magnitude - a.magnitude) + } + case (.minus, .plus): + if b.magnitude >= a.magnitude { + return BigInt(sign: .plus, magnitude: b.magnitude - a.magnitude) + } + else { + return BigInt(sign: .minus, magnitude: a.magnitude - b.magnitude) + } + } + } + + /// Add `b` to `a` in place. + public static func +=(a: inout BigInt, b: BigInt) { + a = a + b + } +} + diff --git a/Pods/BigInt/sources/BigInt.swift b/Pods/BigInt/sources/BigInt.swift new file mode 100644 index 0000000..6976c20 --- /dev/null +++ b/Pods/BigInt/sources/BigInt.swift @@ -0,0 +1,76 @@ +// +// BigInt.swift +// BigInt +// +// Created by Károly Lőrentey on 2015-12-27. +// Copyright © 2016-2017 Károly Lőrentey. +// + +import SipHash + +//MARK: BigInt + +/// An arbitary precision signed integer type, also known as a "big integer". +/// +/// Operations on big integers never overflow, but they might take a long time to execute. +/// The amount of memory (and address space) available is the only constraint to the magnitude of these numbers. +/// +/// This particular big integer type uses base-2^64 digits to represent integers. +/// +/// `BigInt` is essentially a tiny wrapper that extends `BigUInt` with a sign bit and provides signed integer +/// operations. Both the underlying absolute value and the negative/positive flag are available as read-write +/// properties. +/// +/// Not all algorithms of `BigUInt` are available for `BigInt` values; for example, there is no square root or +/// primality test for signed integers. When you need to call one of these, just extract the absolute value: +/// +/// ```Swift +/// BigInt(255).abs.isPrime() // Returns false +/// ``` +/// +public struct BigInt: SignedInteger { + public enum Sign { + case plus + case minus + } + + public typealias Magnitude = BigUInt + + /// The type representing a digit in `BigInt`'s underlying number system. + public typealias Word = BigUInt.Word + + public static var isSigned: Bool { + return true + } + + /// The absolute value of this integer. + public var magnitude: BigUInt + + /// True iff the value of this integer is negative. + public var sign: Sign + + /// Initializes a new big integer with the provided absolute number and sign flag. + public init(sign: Sign, magnitude: BigUInt) { + self.sign = (magnitude.isZero ? .plus : sign) + self.magnitude = magnitude + } + + /// Return true iff this integer is zero. + /// + /// - Complexity: O(1) + public var isZero: Bool { + return magnitude.isZero + } + + /// Returns `-1` if this value is negative and `1` if it’s positive; otherwise, `0`. + /// + /// - Returns: The sign of this number, expressed as an integer of the same type. + public func signum() -> BigInt { + switch sign { + case .plus: + return isZero ? 0 : 1 + case .minus: + return -1 + } + } +} diff --git a/Pods/BigInt/sources/BigUInt.swift b/Pods/BigInt/sources/BigUInt.swift new file mode 100644 index 0000000..81aa9a8 --- /dev/null +++ b/Pods/BigInt/sources/BigUInt.swift @@ -0,0 +1,386 @@ +// +// BigUInt.swift +// BigInt +// +// Created by Károly Lőrentey on 2015-12-26. +// Copyright © 2016-2017 Károly Lőrentey. +// + +/// An arbitary precision unsigned integer type, also known as a "big integer". +/// +/// Operations on big integers never overflow, but they may take a long time to execute. +/// The amount of memory (and address space) available is the only constraint to the magnitude of these numbers. +/// +/// This particular big integer type uses base-2^64 digits to represent integers; you can think of it as a wrapper +/// around `Array`. (In fact, `BigUInt` only uses an array if there are more than two digits.) +public struct BigUInt: UnsignedInteger { + /// The type representing a digit in `BigUInt`'s underlying number system. + public typealias Word = UInt + + /// The storage variants of a `BigUInt`. + enum Kind { + /// Value consists of the two specified words (low and high). Either or both words may be zero. + case inline(Word, Word) + /// Words are stored in a slice of the storage array. + case slice(from: Int, to: Int) + /// Words are stored in the storage array. + case array + } + + internal fileprivate (set) var kind: Kind // Internal for testing only + internal fileprivate (set) var storage: [Word] // Internal for testing only; stored separately to prevent COW copies + + /// Initializes a new BigUInt with value 0. + public init() { + self.kind = .inline(0, 0) + self.storage = [] + } + + internal init(word: Word) { + self.kind = .inline(word, 0) + self.storage = [] + } + + internal init(low: Word, high: Word) { + self.kind = .inline(low, high) + self.storage = [] + } + + /// Initializes a new BigUInt with the specified digits. The digits are ordered from least to most significant. + public init(words: [Word]) { + self.kind = .array + self.storage = words + normalize() + } + + internal init(words: [Word], from startIndex: Int, to endIndex: Int) { + self.kind = .slice(from: startIndex, to: endIndex) + self.storage = words + normalize() + } +} + +extension BigUInt { + public static var isSigned: Bool { + return false + } + + /// Return true iff this integer is zero. + /// + /// - Complexity: O(1) + var isZero: Bool { + switch kind { + case .inline(0, 0): return true + case .array: return storage.isEmpty + default: + return false + } + } + + /// Returns `1` if this value is, positive; otherwise, `0`. + /// + /// - Returns: The sign of this number, expressed as an integer of the same type. + public func signum() -> BigUInt { + return isZero ? 0 : 1 + } +} + +extension BigUInt { + mutating func ensureArray() { + switch kind { + case let .inline(w0, w1): + kind = .array + storage = w1 != 0 ? [w0, w1] + : w0 != 0 ? [w0] + : [] + case let .slice(from: start, to: end): + kind = .array + storage = Array(storage[start ..< end]) + case .array: + break + } + } + + var capacity: Int { + guard case .array = kind else { return 0 } + return storage.capacity + } + + mutating func reserveCapacity(_ minimumCapacity: Int) { + switch kind { + case let .inline(w0, w1): + kind = .array + storage.reserveCapacity(minimumCapacity) + if w1 != 0 { + storage.append(w0) + storage.append(w1) + } + else if w0 != 0 { + storage.append(w0) + } + case let .slice(from: start, to: end): + kind = .array + var words: [Word] = [] + words.reserveCapacity(Swift.max(end - start, minimumCapacity)) + words.append(contentsOf: storage[start ..< end]) + storage = words + case .array: + storage.reserveCapacity(minimumCapacity) + } + } + + /// Gets rid of leading zero digits in the digit array and converts slices into inline digits when possible. + internal mutating func normalize() { + switch kind { + case .slice(from: let start, to: var end): + assert(start >= 0 && end <= storage.count && start <= end) + while start < end, storage[end - 1] == 0 { + end -= 1 + } + switch end - start { + case 0: + kind = .inline(0, 0) + storage = [] + case 1: + kind = .inline(storage[start], 0) + storage = [] + case 2: + kind = .inline(storage[start], storage[start + 1]) + storage = [] + case storage.count: + assert(start == 0) + kind = .array + default: + kind = .slice(from: start, to: end) + } + case .array where storage.last == 0: + while storage.last == 0 { + storage.removeLast() + } + default: + break + } + } + + /// Set this integer to 0 without releasing allocated storage capacity (if any). + mutating func clear() { + self.load(0) + } + + /// Set this integer to `value` by copying its digits without releasing allocated storage capacity (if any). + mutating func load(_ value: BigUInt) { + switch kind { + case .inline, .slice: + self = value + case .array: + self.storage.removeAll(keepingCapacity: true) + self.storage.append(contentsOf: value.words) + } + } +} + +extension BigUInt { + //MARK: Collection-like members + + /// The number of digits in this integer, excluding leading zero digits. + var count: Int { + switch kind { + case let .inline(w0, w1): + return w1 != 0 ? 2 + : w0 != 0 ? 1 + : 0 + case let .slice(from: start, to: end): + return end - start + case .array: + return storage.count + } + } + + /// Get or set a digit at a given index. + /// + /// - Note: Unlike a normal collection, it is OK for the index to be greater than or equal to `endIndex`. + /// The subscripting getter returns zero for indexes beyond the most significant digit. + /// Setting these extended digits automatically appends new elements to the underlying digit array. + /// - Requires: index >= 0 + /// - Complexity: The getter is O(1). The setter is O(1) if the conditions below are true; otherwise it's O(count). + /// - The integer's storage is not shared with another integer + /// - The integer wasn't created as a slice of another integer + /// - `index < count` + subscript(_ index: Int) -> Word { + get { + precondition(index >= 0) + switch (kind, index) { + case (.inline(let w0, _), 0): return w0 + case (.inline(_, let w1), 1): return w1 + case (.slice(from: let start, to: let end), _) where index < end - start: + return storage[start + index] + case (.array, _) where index < storage.count: + return storage[index] + default: + return 0 + } + } + set(word) { + precondition(index >= 0) + switch (kind, index) { + case let (.inline(_, w1), 0): + kind = .inline(word, w1) + case let (.inline(w0, _), 1): + kind = .inline(w0, word) + case let (.slice(from: start, to: end), _) where index < end - start: + replace(at: index, with: word) + case (.array, _) where index < storage.count: + replace(at: index, with: word) + default: + extend(at: index, with: word) + } + } + } + + private mutating func replace(at index: Int, with word: Word) { + ensureArray() + precondition(index < storage.count) + storage[index] = word + if word == 0, index == storage.count - 1 { + normalize() + } + } + + private mutating func extend(at index: Int, with word: Word) { + guard word != 0 else { return } + reserveCapacity(index + 1) + precondition(index >= storage.count) + storage.append(contentsOf: repeatElement(0, count: index - storage.count)) + storage.append(word) + } + + /// Returns an integer built from the digits of this integer in the given range. + internal func extract(_ bounds: Range) -> BigUInt { + switch kind { + case let .inline(w0, w1): + let bounds = bounds.clamped(to: 0 ..< 2) + if bounds == 0 ..< 2 { + return BigUInt(low: w0, high: w1) + } + else if bounds == 0 ..< 1 { + return BigUInt(word: w0) + } + else if bounds == 1 ..< 2 { + return BigUInt(word: w1) + } + else { + return BigUInt() + } + case let .slice(from: start, to: end): + let s = Swift.min(end, start + Swift.max(bounds.lowerBound, 0)) + let e = Swift.max(s, (bounds.upperBound > end - start ? end : start + bounds.upperBound)) + return BigUInt(words: storage, from: s, to: e) + case .array: + let b = bounds.clamped(to: storage.startIndex ..< storage.endIndex) + return BigUInt(words: storage, from: b.lowerBound, to: b.upperBound) + } + } + + internal func extract(_ bounds: Bounds) -> BigUInt where Bounds.Bound == Int { + return self.extract(bounds.relative(to: 0 ..< Int.max)) + } +} + +extension BigUInt { + internal mutating func shiftRight(byWords amount: Int) { + assert(amount >= 0) + guard amount > 0 else { return } + switch kind { + case let .inline(_, w1) where amount == 1: + kind = .inline(w1, 0) + case .inline(_, _): + kind = .inline(0, 0) + case let .slice(from: start, to: end): + let s = start + amount + if s >= end { + kind = .inline(0, 0) + } + else { + kind = .slice(from: s, to: end) + normalize() + } + case .array: + if amount >= storage.count { + storage.removeAll(keepingCapacity: true) + } + else { + storage.removeFirst(amount) + } + } + } + + internal mutating func shiftLeft(byWords amount: Int) { + assert(amount >= 0) + guard amount > 0 else { return } + guard !isZero else { return } + switch kind { + case let .inline(w0, 0) where amount == 1: + kind = .inline(0, w0) + case let .inline(w0, w1): + let c = (w1 == 0 ? 1 : 2) + storage.reserveCapacity(amount + c) + storage.append(contentsOf: repeatElement(0, count: amount)) + storage.append(w0) + if w1 != 0 { + storage.append(w1) + } + kind = .array + case let .slice(from: start, to: end): + var words: [Word] = [] + words.reserveCapacity(amount + count) + words.append(contentsOf: repeatElement(0, count: amount)) + words.append(contentsOf: storage[start ..< end]) + storage = words + kind = .array + case .array: + storage.insert(contentsOf: repeatElement(0, count: amount), at: 0) + } + } +} + +extension BigUInt { + //MARK: Low and High + + /// Split this integer into a high-order and a low-order part. + /// + /// - Requires: count > 1 + /// - Returns: `(low, high)` such that + /// - `self == low.add(high, shiftedBy: middleIndex)` + /// - `high.width <= floor(width / 2)` + /// - `low.width <= ceil(width / 2)` + /// - Complexity: Typically O(1), but O(count) in the worst case, because high-order zero digits need to be removed after the split. + internal var split: (high: BigUInt, low: BigUInt) { + precondition(count > 1) + let mid = middleIndex + return (self.extract(mid...), self.extract(.. 1 + internal var low: BigUInt { + return self.extract(0 ..< middleIndex) + } + + /// The high-order half of this BigUInt. + /// + /// - Returns: `self[middleIndex ..< count]` + /// - Requires: count > 1 + internal var high: BigUInt { + return self.extract(middleIndex ..< count) + } +} + diff --git a/Pods/BigInt/sources/Bitwise Ops.swift b/Pods/BigInt/sources/Bitwise Ops.swift new file mode 100644 index 0000000..0d00148 --- /dev/null +++ b/Pods/BigInt/sources/Bitwise Ops.swift @@ -0,0 +1,121 @@ +// +// Bitwise Ops.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +//MARK: Bitwise Operations + +extension BigUInt { + /// Return the ones' complement of `a`. + /// + /// - Complexity: O(a.count) + public static prefix func ~(a: BigUInt) -> BigUInt { + return BigUInt(words: a.words.map { ~$0 }) + } + + /// Calculate the bitwise OR of `a` and `b`, and store the result in `a`. + /// + /// - Complexity: O(max(a.count, b.count)) + public static func |= (a: inout BigUInt, b: BigUInt) { + a.reserveCapacity(b.count) + for i in 0 ..< b.count { + a[i] |= b[i] + } + } + + /// Calculate the bitwise AND of `a` and `b` and return the result. + /// + /// - Complexity: O(max(a.count, b.count)) + public static func &= (a: inout BigUInt, b: BigUInt) { + for i in 0 ..< Swift.max(a.count, b.count) { + a[i] &= b[i] + } + } + + /// Calculate the bitwise XOR of `a` and `b` and return the result. + /// + /// - Complexity: O(max(a.count, b.count)) + public static func ^= (a: inout BigUInt, b: BigUInt) { + a.reserveCapacity(b.count) + for i in 0 ..< b.count { + a[i] ^= b[i] + } + } +} + +extension BigInt { + public static prefix func ~(x: BigInt) -> BigInt { + switch x.sign { + case .plus: + return BigInt(sign: .minus, magnitude: x.magnitude + 1) + case .minus: + return BigInt(sign: .plus, magnitude: x.magnitude - 1) + } + } + + public static func &(lhs: inout BigInt, rhs: BigInt) -> BigInt { + let left = lhs.words + let right = rhs.words + // Note we aren't using left.count/right.count here; we account for the sign bit separately later. + let count = Swift.max(lhs.magnitude.count, rhs.magnitude.count) + var words: [UInt] = [] + words.reserveCapacity(count) + for i in 0 ..< count { + words.append(left[i] & right[i]) + } + if lhs.sign == .minus && rhs.sign == .minus { + words.twosComplement() + return BigInt(sign: .minus, magnitude: BigUInt(words: words)) + } + return BigInt(sign: .plus, magnitude: BigUInt(words: words)) + } + + public static func |(lhs: inout BigInt, rhs: BigInt) -> BigInt { + let left = lhs.words + let right = rhs.words + // Note we aren't using left.count/right.count here; we account for the sign bit separately later. + let count = Swift.max(lhs.magnitude.count, rhs.magnitude.count) + var words: [UInt] = [] + words.reserveCapacity(count) + for i in 0 ..< count { + words.append(left[i] | right[i]) + } + if lhs.sign == .minus || rhs.sign == .minus { + words.twosComplement() + return BigInt(sign: .minus, magnitude: BigUInt(words: words)) + } + return BigInt(sign: .plus, magnitude: BigUInt(words: words)) + } + + public static func ^(lhs: inout BigInt, rhs: BigInt) -> BigInt { + let left = lhs.words + let right = rhs.words + // Note we aren't using left.count/right.count here; we account for the sign bit separately later. + let count = Swift.max(lhs.magnitude.count, rhs.magnitude.count) + var words: [UInt] = [] + words.reserveCapacity(count) + for i in 0 ..< count { + words.append(left[i] ^ right[i]) + } + if (lhs.sign == .minus) != (rhs.sign == .minus) { + words.twosComplement() + return BigInt(sign: .minus, magnitude: BigUInt(words: words)) + } + return BigInt(sign: .plus, magnitude: BigUInt(words: words)) + } + + public static func &=(lhs: inout BigInt, rhs: BigInt) { + lhs = lhs & rhs + } + + public static func |=(lhs: inout BigInt, rhs: BigInt) { + lhs = lhs | rhs + } + + public static func ^=(lhs: inout BigInt, rhs: BigInt) { + lhs = lhs ^ rhs + } +} diff --git a/Pods/BigInt/sources/Codable.swift b/Pods/BigInt/sources/Codable.swift new file mode 100644 index 0000000..b53b30b --- /dev/null +++ b/Pods/BigInt/sources/Codable.swift @@ -0,0 +1,155 @@ +// +// Codable.swift +// BigInt +// +// Created by Károly Lőrentey on 2017-8-11. +// Copyright © 2016-2017 Károly Lőrentey. +// + + +// Little-endian to big-endian +struct Units: RandomAccessCollection +where Words.Element: FixedWidthInteger, Words.Index == Int { + typealias Word = Words.Element + let words: Words + init(of type: Unit.Type, _ words: Words) { + precondition(Word.bitWidth % Unit.bitWidth == 0 || Unit.bitWidth % Word.bitWidth == 0) + self.words = words + } + var count: Int { return (words.count * Word.bitWidth + Unit.bitWidth - 1) / Unit.bitWidth } + var startIndex: Int { return 0 } + var endIndex: Int { return count } + subscript(_ index: Int) -> Unit { + let index = count - 1 - index + if Unit.bitWidth == Word.bitWidth { + return Unit(words[index]) + } + else if Unit.bitWidth > Word.bitWidth { + let c = Unit.bitWidth / Word.bitWidth + var unit: Unit = 0 + var j = 0 + for i in (c * index) ..< Swift.min(c * (index + 1), words.endIndex) { + unit |= Unit(words[i]) << j + j += Word.bitWidth + } + return unit + } + // Unit.bitWidth < Word.bitWidth + let c = Word.bitWidth / Unit.bitWidth + let i = index / c + let j = index % c + return Unit(truncatingIfNeeded: words[i] >> (j * Unit.bitWidth)) + } +} + +extension Array where Element: FixedWidthInteger { + // Big-endian to little-endian + init(count: Int?, generator: () throws -> Unit?) rethrows { + typealias Word = Element + precondition(Word.bitWidth % Unit.bitWidth == 0 || Unit.bitWidth % Word.bitWidth == 0) + self = [] + if Unit.bitWidth == Word.bitWidth { + if let count = count { + self.reserveCapacity(count) + } + while let unit = try generator() { + self.append(Word(unit)) + } + } + else if Unit.bitWidth > Word.bitWidth { + let wordsPerUnit = Unit.bitWidth / Word.bitWidth + if let count = count { + self.reserveCapacity(count * wordsPerUnit) + } + while let unit = try generator() { + var shift = Unit.bitWidth - Word.bitWidth + while shift >= 0 { + self.append(Word(truncatingIfNeeded: unit >> shift)) + shift -= Word.bitWidth + } + } + } + else { + let unitsPerWord = Word.bitWidth / Unit.bitWidth + if let count = count { + self.reserveCapacity((count + unitsPerWord - 1) / unitsPerWord) + } + var word: Word = 0 + var c = 0 + while let unit = try generator() { + word <<= Unit.bitWidth + word |= Word(unit) + c += Unit.bitWidth + if c == Word.bitWidth { + self.append(word) + word = 0 + c = 0 + } + } + if c > 0 { + self.append(word << c) + var shifted: Word = 0 + for i in self.indices { + let word = self[i] + self[i] = shifted | (word >> c) + shifted = word << (Word.bitWidth - c) + } + } + } + self.reverse() + } +} + +extension BigInt: Codable { + public init(from decoder: Decoder) throws { + var container = try decoder.unkeyedContainer() + + // Decode sign + let sign: BigInt.Sign + switch try container.decode(String.self) { + case "+": + sign = .plus + case "-": + sign = .minus + default: + throw DecodingError.dataCorrupted(.init(codingPath: container.codingPath, + debugDescription: "Invalid big integer sign")) + } + + // Decode magnitude + let words = try [UInt](count: container.count?.advanced(by: -1)) { () -> UInt64? in + guard !container.isAtEnd else { return nil } + return try container.decode(UInt64.self) + } + let magnitude = BigUInt(words: words) + + self.init(sign: sign, magnitude: magnitude) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.unkeyedContainer() + try container.encode(sign == .plus ? "+" : "-") + let units = Units(of: UInt64.self, self.magnitude.words) + if units.isEmpty { + try container.encode(0 as UInt64) + } + else { + try container.encode(contentsOf: units) + } + } +} + +extension BigUInt: Codable { + public init(from decoder: Decoder) throws { + let value = try BigInt(from: decoder) + guard value.sign == .plus else { + throw DecodingError.dataCorrupted(.init(codingPath: decoder.codingPath, + debugDescription: "BigUInt cannot hold a negative value")) + } + self = value.magnitude + } + + public func encode(to encoder: Encoder) throws { + try BigInt(sign: .plus, magnitude: self).encode(to: encoder) + } +} diff --git a/Pods/BigInt/sources/Comparable.swift b/Pods/BigInt/sources/Comparable.swift new file mode 100644 index 0000000..d9ab87e --- /dev/null +++ b/Pods/BigInt/sources/Comparable.swift @@ -0,0 +1,63 @@ +// +// Comparable.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +import Foundation + +extension BigUInt: Comparable { + //MARK: Comparison + + /// Compare `a` to `b` and return an `NSComparisonResult` indicating their order. + /// + /// - Complexity: O(count) + public static func compare(_ a: BigUInt, _ b: BigUInt) -> ComparisonResult { + if a.count != b.count { return a.count > b.count ? .orderedDescending : .orderedAscending } + for i in (0 ..< a.count).reversed() { + let ad = a[i] + let bd = b[i] + if ad != bd { return ad > bd ? .orderedDescending : .orderedAscending } + } + return .orderedSame + } + + /// Return true iff `a` is equal to `b`. + /// + /// - Complexity: O(count) + public static func ==(a: BigUInt, b: BigUInt) -> Bool { + return BigUInt.compare(a, b) == .orderedSame + } + + /// Return true iff `a` is less than `b`. + /// + /// - Complexity: O(count) + public static func <(a: BigUInt, b: BigUInt) -> Bool { + return BigUInt.compare(a, b) == .orderedAscending + } +} + +extension BigInt { + /// Return true iff `a` is equal to `b`. + public static func ==(a: BigInt, b: BigInt) -> Bool { + return a.sign == b.sign && a.magnitude == b.magnitude + } + + /// Return true iff `a` is less than `b`. + public static func <(a: BigInt, b: BigInt) -> Bool { + switch (a.sign, b.sign) { + case (.plus, .plus): + return a.magnitude < b.magnitude + case (.plus, .minus): + return false + case (.minus, .plus): + return true + case (.minus, .minus): + return a.magnitude > b.magnitude + } + } +} + + diff --git a/Pods/BigInt/sources/Data Conversion.swift b/Pods/BigInt/sources/Data Conversion.swift new file mode 100644 index 0000000..ffc0ac2 --- /dev/null +++ b/Pods/BigInt/sources/Data Conversion.swift @@ -0,0 +1,107 @@ +// +// Data Conversion.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-04. +// Copyright © 2016-2017 Károly Lőrentey. +// + +import Foundation + +extension BigUInt { + //MARK: NSData Conversion + + public init(_ buffer: UnsafeRawBufferPointer) { + // This assumes Word is binary. + precondition(Word.bitWidth % 8 == 0) + + self.init() + + let length = buffer.count + guard length > 0 else { return } + let bytesPerDigit = Word.bitWidth / 8 + var index = length / bytesPerDigit + var c = bytesPerDigit - length % bytesPerDigit + if c == bytesPerDigit { + c = 0 + index -= 1 + } + + var word: Word = 0 + for byte in buffer { + word <<= 8 + word += Word(byte) + c += 1 + if c == bytesPerDigit { + self[index] = word + index -= 1 + c = 0 + word = 0 + } + } + assert(c == 0 && word == 0 && index == -1) + } + + + /// Initializes an integer from the bits stored inside a piece of `Data`. + /// The data is assumed to be in network (big-endian) byte order. + public init(_ data: Data) { + // This assumes Word is binary. + precondition(Word.bitWidth % 8 == 0) + + self.init() + + let length = data.count + guard length > 0 else { return } + let bytesPerDigit = Word.bitWidth / 8 + var index = length / bytesPerDigit + var c = bytesPerDigit - length % bytesPerDigit + if c == bytesPerDigit { + c = 0 + index -= 1 + } + var word: Word = 0 + data.enumerateBytes { p, byteIndex, stop in + for byte in p { + word <<= 8 + word += Word(byte) + c += 1 + if c == bytesPerDigit { + self[index] = word + index -= 1 + c = 0 + word = 0 + } + } + } + assert(c == 0 && word == 0 && index == -1) + } + + /// Return a `Data` value that contains the base-256 representation of this integer, in network (big-endian) byte order. + public func serialize() -> Data { + // This assumes Digit is binary. + precondition(Word.bitWidth % 8 == 0) + + let byteCount = (self.bitWidth + 7) / 8 + + guard byteCount > 0 else { return Data() } + + var data = Data(count: byteCount) + data.withUnsafeMutableBytes { (p: UnsafeMutablePointer) -> Void in + var i = byteCount - 1 + for var word in self.words { + for _ in 0 ..< Word.bitWidth / 8 { + p[i] = UInt8(word & 0xFF) + word >>= 8 + if i == 0 { + assert(word == 0) + break + } + i -= 1 + } + } + } + return data + } +} + diff --git a/Pods/BigInt/sources/Division.swift b/Pods/BigInt/sources/Division.swift new file mode 100644 index 0000000..4393f52 --- /dev/null +++ b/Pods/BigInt/sources/Division.swift @@ -0,0 +1,374 @@ +// +// Division.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +//MARK: Full-width multiplication and division + +extension FixedWidthInteger where Magnitude == Self { + private var halfShift: Self { + return Self(Self.bitWidth / 2) + + } + private var high: Self { + return self &>> halfShift + } + + private var low: Self { + let mask: Self = 1 &<< halfShift - 1 + return self & mask + } + + private var upshifted: Self { + return self &<< halfShift + } + + private var split: (high: Self, low: Self) { + return (self.high, self.low) + } + + private init(_ value: (high: Self, low: Self)) { + self = value.high.upshifted + value.low + } + + /// Divide the double-width integer `dividend` by `self` and return the quotient and remainder. + /// + /// - Requires: `dividend.high < self`, so that the result will fit in a single digit. + /// - Complexity: O(1) with 2 divisions, 6 multiplications and ~12 or so additions/subtractions. + internal func fastDividingFullWidth(_ dividend: (high: Self, low: Self.Magnitude)) -> (quotient: Self, remainder: Self) { + // Division is complicated; doing it with single-digit operations is maddeningly complicated. + // This is a Swift adaptation for "divlu2" in Hacker's Delight, + // which is in turn a C adaptation of Knuth's Algorithm D (TAOCP vol 2, 4.3.1). + precondition(dividend.high < self) + + // This replaces the implementation in stdlib, which is much slower. + // FIXME: Speed up stdlib. It should use full-width idiv on Intel processors, and + // fall back to a reasonably fast algorithm elsewhere. + + // The trick here is that we're actually implementing a 4/2 long division using half-words, + // with the long division loop unrolled into two 3/2 half-word divisions. + // Luckily, 3/2 half-word division can be approximated by a single full-word division operation + // that, when the divisor is normalized, differs from the correct result by at most 2. + + /// Find the half-word quotient in `u / vn`, which must be normalized. + /// `u` contains three half-words in the two halves of `u.high` and the lower half of + /// `u.low`. (The weird distribution makes for a slightly better fit with the input.) + /// `vn` contains the normalized divisor, consisting of two half-words. + /// + /// - Requires: u.high < vn && u.low.high == 0 && vn.leadingZeroBitCount == 0 + func quotient(dividing u: (high: Self, low: Self), by vn: Self) -> Self { + let (vn1, vn0) = vn.split + // Get approximate quotient. + let (q, r) = u.high.quotientAndRemainder(dividingBy: vn1) + let p = q * vn0 + // q is often already correct, but sometimes the approximation overshoots by at most 2. + // The code that follows checks for this while being careful to only perform single-digit operations. + if q.high == 0 && p <= r.upshifted + u.low { return q } + let r2 = r + vn1 + if r2.high != 0 { return q - 1 } + if (q - 1).high == 0 && p - vn0 <= r2.upshifted + u.low { return q - 1 } + //assert((r + 2 * vn1).high != 0 || p - 2 * vn0 <= (r + 2 * vn1).upshifted + u.low) + return q - 2 + } + /// Divide 3 half-digits by 2 half-digits to get a half-digit quotient and a full-digit remainder. + /// + /// - Requires: u.high < v && u.low.high == 0 && vn.width = width(Digit) + func quotientAndRemainder(dividing u: (high: Self, low: Self), by v: Self) -> (quotient: Self, remainder: Self) { + let q = quotient(dividing: u, by: v) + // Note that `uh.low` masks off a couple of bits, and `q * v` and the + // subtraction are likely to overflow. Despite this, the end result (remainder) will + // still be correct and it will fit inside a single (full) Digit. + let r = Self(u) &- q &* v + assert(r < v) + return (q, r) + } + + // Normalize the dividend and the divisor (self) such that the divisor has no leading zeroes. + let z = Self(self.leadingZeroBitCount) + let w = Self(Self.bitWidth) - z + let vn = self << z + + let un32 = (z == 0 ? dividend.high : (dividend.high &<< z) | (dividend.low &>> w)) // No bits are lost + let un10 = dividend.low &<< z + let (un1, un0) = un10.split + + // Divide `(un32,un10)` by `vn`, splitting the full 4/2 division into two 3/2 ones. + let (q1, un21) = quotientAndRemainder(dividing: (un32, un1), by: vn) + let (q0, rn) = quotientAndRemainder(dividing: (un21, un0), by: vn) + + // Undo normalization of the remainder and combine the two halves of the quotient. + let mod = rn >> z + let div = Self((q1, q0)) + return (div, mod) + } + + /// Return the quotient of the 3/2-word division `x/y` as a single word. + /// + /// - Requires: (x.0, x.1) <= y && y.0.high != 0 + /// - Returns: The exact value when it fits in a single word, otherwise `Self`. + static func approximateQuotient(dividing x: (Self, Self, Self), by y: (Self, Self)) -> Self { + // Start with q = (x.0, x.1) / y.0, (or Word.max on overflow) + var q: Self + var r: Self + if x.0 == y.0 { + q = Self.max + let (s, o) = x.0.addingReportingOverflow(x.1) + if o { return q } + r = s + } + else { + (q, r) = y.0.fastDividingFullWidth((x.0, x.1)) + } + // Now refine q by considering x.2 and y.1. + // Note that since y is normalized, q * y - x is between 0 and 2. + let (ph, pl) = q.multipliedFullWidth(by: y.1) + if ph < r || (ph == r && pl <= x.2) { return q } + + let (r1, ro) = r.addingReportingOverflow(y.0) + if ro { return q - 1 } + + let (pl1, so) = pl.subtractingReportingOverflow(y.1) + let ph1 = (so ? ph - 1 : ph) + + if ph1 < r1 || (ph1 == r1 && pl1 <= x.2) { return q - 1 } + return q - 2 + } +} + +extension BigUInt { + //MARK: Division + + /// Divide this integer by the word `y`, leaving the quotient in its place and returning the remainder. + /// + /// - Requires: y > 0 + /// - Complexity: O(count) + internal mutating func divide(byWord y: Word) -> Word { + precondition(y > 0) + if y == 1 { return 0 } + + var remainder: Word = 0 + for i in (0 ..< count).reversed() { + let u = self[i] + (self[i], remainder) = y.fastDividingFullWidth((remainder, u)) + } + return remainder + } + + /// Divide this integer by the word `y` and return the resulting quotient and remainder. + /// + /// - Requires: y > 0 + /// - Returns: (quotient, remainder) where quotient = floor(x/y), remainder = x - quotient * y + /// - Complexity: O(x.count) + internal func quotientAndRemainder(dividingByWord y: Word) -> (quotient: BigUInt, remainder: Word) { + var div = self + let mod = div.divide(byWord: y) + return (div, mod) + } + + /// Divide `x` by `y`, putting the quotient in `x` and the remainder in `y`. + /// Reusing integers like this reduces the number of allocations during the calculation. + static func divide(_ x: inout BigUInt, by y: inout BigUInt) { + // This is a Swift adaptation of "divmnu" from Hacker's Delight, which is in + // turn a C adaptation of Knuth's Algorithm D (TAOCP vol 2, 4.3.1). + + precondition(!y.isZero) + + // First, let's take care of the easy cases. + if x < y { + (x, y) = (0, x) + return + } + if y.count == 1 { + // The single-word case reduces to a simpler loop. + y = BigUInt(x.divide(byWord: y[0])) + return + } + + // In the hard cases, we will perform the long division algorithm we learned in school. + // It works by successively calculating the single-word quotient of the top y.count + 1 + // words of x divided by y, replacing the top of x with the remainder, and repeating + // the process one word lower. + // + // The tricky part is that the algorithm needs to be able to do n+1/n word divisions, + // but we only have a primitive for dividing two words by a single + // word. (Remember that this step is also tricky when we do it on paper!) + // + // The solution is that the long division can be approximated by a single full division + // using just the most significant words. We can then use multiplications and + // subtractions to refine the approximation until we get the correct quotient word. + // + // We could do this by doing a simple 2/1 full division, but Knuth goes one step further, + // and implements a 3/2 division. This results in an exact approximation in the + // vast majority of cases, eliminating an extra subtraction over big integers. + // + // The function `approximateQuotient` above implements Knuth's 3/2 division algorithm. + // It requires that the divisor's most significant word is larger than + // Word.max / 2. This ensures that the approximation has tiny error bounds, + // which is what makes this entire approach viable. + // To satisfy this requirement, we will normalize the division by multiplying + // both the divisor and the dividend by the same (small) factor. + let z = y.leadingZeroBitCount + y <<= z + x <<= z // We'll calculate the remainder in the normalized dividend. + var quotient = BigUInt() + assert(y.leadingZeroBitCount == 0) + + // We're ready to start the long division! + let dc = y.count + let d1 = y[dc - 1] + let d0 = y[dc - 2] + var product: BigUInt = 0 + for j in (dc ... x.count).reversed() { + // Approximate dividing the top dc+1 words of `remainder` using the topmost 3/2 words. + let r2 = x[j] + let r1 = x[j - 1] + let r0 = x[j - 2] + let q = Word.approximateQuotient(dividing: (r2, r1, r0), by: (d1, d0)) + + // Multiply the entire divisor with `q` and subtract the result from remainder. + // Normalization ensures the 3/2 quotient will either be exact for the full division, or + // it may overshoot by at most 1, in which case the product will be greater + // than the remainder. + product.load(y) + product.multiply(byWord: q) + if product <= x.extract(j - dc ..< j + 1) { + x.subtract(product, shiftedBy: j - dc) + quotient[j - dc] = q + } + else { + // This case is extremely rare -- it has a probability of 1/2^(Word.bitWidth - 1). + x.add(y, shiftedBy: j - dc) + x.subtract(product, shiftedBy: j - dc) + quotient[j - dc] = q - 1 + } + } + // The remainder's normalization needs to be undone, but otherwise we're done. + x >>= z + y = x + x = quotient + } + + /// Divide `x` by `y`, putting the remainder in `x`. + mutating func formRemainder(dividingBy y: BigUInt, normalizedBy shift: Int) { + precondition(!y.isZero) + assert(y.leadingZeroBitCount == 0) + if y.count == 1 { + let remainder = self.divide(byWord: y[0] >> shift) + self.load(BigUInt(remainder)) + return + } + self <<= shift + if self >= y { + let dc = y.count + let d1 = y[dc - 1] + let d0 = y[dc - 2] + var product: BigUInt = 0 + for j in (dc ... self.count).reversed() { + let r2 = self[j] + let r1 = self[j - 1] + let r0 = self[j - 2] + let q = Word.approximateQuotient(dividing: (r2, r1, r0), by: (d1, d0)) + product.load(y) + product.multiply(byWord: q) + if product <= self.extract(j - dc ..< j + 1) { + self.subtract(product, shiftedBy: j - dc) + } + else { + self.add(y, shiftedBy: j - dc) + self.subtract(product, shiftedBy: j - dc) + } + } + } + self >>= shift + } + + + /// Divide this integer by `y` and return the resulting quotient and remainder. + /// + /// - Requires: `y > 0` + /// - Returns: `(quotient, remainder)` where `quotient = floor(self/y)`, `remainder = self - quotient * y` + /// - Complexity: O(count^2) + public func quotientAndRemainder(dividingBy y: BigUInt) -> (quotient: BigUInt, remainder: BigUInt) { + var x = self + var y = y + BigUInt.divide(&x, by: &y) + return (x, y) + } + + /// Divide `x` by `y` and return the quotient. + /// + /// - Note: Use `divided(by:)` if you also need the remainder. + public static func /(x: BigUInt, y: BigUInt) -> BigUInt { + return x.quotientAndRemainder(dividingBy: y).quotient + } + + /// Divide `x` by `y` and return the remainder. + /// + /// - Note: Use `divided(by:)` if you also need the remainder. + public static func %(x: BigUInt, y: BigUInt) -> BigUInt { + var x = x + let shift = y.leadingZeroBitCount + x.formRemainder(dividingBy: y << shift, normalizedBy: shift) + return x + } + + /// Divide `x` by `y` and store the quotient in `x`. + /// + /// - Note: Use `divided(by:)` if you also need the remainder. + public static func /=(x: inout BigUInt, y: BigUInt) { + var y = y + BigUInt.divide(&x, by: &y) + } + + /// Divide `x` by `y` and store the remainder in `x`. + /// + /// - Note: Use `divided(by:)` if you also need the remainder. + public static func %=(x: inout BigUInt, y: BigUInt) { + let shift = y.leadingZeroBitCount + x.formRemainder(dividingBy: y << shift, normalizedBy: shift) + } +} + +extension BigInt { + /// Divide this integer by `y` and return the resulting quotient and remainder. + /// + /// - Requires: `y > 0` + /// - Returns: `(quotient, remainder)` where `quotient = floor(self/y)`, `remainder = self - quotient * y` + /// - Complexity: O(count^2) + public func quotientAndRemainder(dividingBy y: BigInt) -> (quotient: BigInt, remainder: BigInt) { + var a = self.magnitude + var b = y.magnitude + BigUInt.divide(&a, by: &b) + return (BigInt(sign: self.sign == y.sign ? .plus : .minus, magnitude: a), + BigInt(sign: self.sign, magnitude: b)) + } + + /// Divide `a` by `b` and return the quotient. Traps if `b` is zero. + public static func /(a: BigInt, b: BigInt) -> BigInt { + return BigInt(sign: a.sign == b.sign ? .plus : .minus, magnitude: a.magnitude / b.magnitude) + } + + /// Divide `a` by `b` and return the remainder. The result has the same sign as `a`. + public static func %(a: BigInt, b: BigInt) -> BigInt { + return BigInt(sign: a.sign, magnitude: a.magnitude % b.magnitude) + } + + /// Return the result of `a` mod `b`. The result is always a nonnegative integer that is less than the absolute value of `b`. + public func modulus(_ mod: BigInt) -> BigInt { + let remainder = self.magnitude % mod.magnitude + return BigInt( + self.sign == .minus && !remainder.isZero + ? mod.magnitude - remainder + : remainder) + } +} + +extension BigInt { + /// Divide `a` by `b` storing the quotient in `a`. + public static func /=(a: inout BigInt, b: BigInt) { a = a / b } + /// Divide `a` by `b` storing the remainder in `a`. + public static func %=(a: inout BigInt, b: BigInt) { a = a % b } +} diff --git a/Pods/BigInt/sources/Exponentiation.swift b/Pods/BigInt/sources/Exponentiation.swift new file mode 100644 index 0000000..9d7ee85 --- /dev/null +++ b/Pods/BigInt/sources/Exponentiation.swift @@ -0,0 +1,119 @@ +// +// Exponentiation.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + //MARK: Exponentiation + + /// Returns this integer raised to the power `exponent`. + /// + /// This function calculates the result by [successively squaring the base while halving the exponent][expsqr]. + /// + /// [expsqr]: https://en.wikipedia.org/wiki/Exponentiation_by_squaring + /// + /// - Note: This function can be unreasonably expensive for large exponents, which is why `exponent` is + /// a simple integer value. If you want to calculate big exponents, you'll probably need to use + /// the modulo arithmetic variant. + /// - Returns: 1 if `exponent == 0`, otherwise `self` raised to `exponent`. (This implies that `0.power(0) == 1`.) + /// - SeeAlso: `BigUInt.power(_:, modulus:)` + /// - Complexity: O((exponent * self.count)^log2(3)) or somesuch. The result may require a large amount of memory, too. + public func power(_ exponent: Int) -> BigUInt { + if exponent == 0 { return 1 } + if exponent == 1 { return self } + if exponent < 0 { + precondition(!self.isZero) + return self == 1 ? 1 : 0 + } + if self <= 1 { return self } + var result = BigUInt(1) + var b = self + var e = exponent + while e > 0 { + if e & 1 == 1 { + result *= b + } + e >>= 1 + b *= b + } + return result + } + + /// Returns the remainder of this integer raised to the power `exponent` in modulo arithmetic under `modulus`. + /// + /// Uses the [right-to-left binary method][rtlb]. + /// + /// [rtlb]: https://en.wikipedia.org/wiki/Modular_exponentiation#Right-to-left_binary_method + /// + /// - Complexity: O(exponent.count * modulus.count^log2(3)) or somesuch + public func power(_ exponent: BigUInt, modulus: BigUInt) -> BigUInt { + precondition(!modulus.isZero) + if modulus == (1 as BigUInt) { return 0 } + let shift = modulus.leadingZeroBitCount + let normalizedModulus = modulus << shift + var result = BigUInt(1) + var b = self + b.formRemainder(dividingBy: normalizedModulus, normalizedBy: shift) + for var e in exponent.words { + for _ in 0 ..< Word.bitWidth { + if e & 1 == 1 { + result *= b + result.formRemainder(dividingBy: normalizedModulus, normalizedBy: shift) + } + e >>= 1 + b *= b + b.formRemainder(dividingBy: normalizedModulus, normalizedBy: shift) + } + } + return result + } +} + +extension BigInt { + /// Returns this integer raised to the power `exponent`. + /// + /// This function calculates the result by [successively squaring the base while halving the exponent][expsqr]. + /// + /// [expsqr]: https://en.wikipedia.org/wiki/Exponentiation_by_squaring + /// + /// - Note: This function can be unreasonably expensive for large exponents, which is why `exponent` is + /// a simple integer value. If you want to calculate big exponents, you'll probably need to use + /// the modulo arithmetic variant. + /// - Returns: 1 if `exponent == 0`, otherwise `self` raised to `exponent`. (This implies that `0.power(0) == 1`.) + /// - SeeAlso: `BigUInt.power(_:, modulus:)` + /// - Complexity: O((exponent * self.count)^log2(3)) or somesuch. The result may require a large amount of memory, too. + public func power(_ exponent: Int) -> BigInt { + return BigInt(sign: self.sign == .minus && exponent & 1 != 0 ? .minus : .plus, + magnitude: self.magnitude.power(exponent)) + } + + /// Returns the remainder of this integer raised to the power `exponent` in modulo arithmetic under `modulus`. + /// + /// Uses the [right-to-left binary method][rtlb]. + /// + /// [rtlb]: https://en.wikipedia.org/wiki/Modular_exponentiation#Right-to-left_binary_method + /// + /// - Complexity: O(exponent.count * modulus.count^log2(3)) or somesuch + public func power(_ exponent: BigInt, modulus: BigInt) -> BigInt { + precondition(!modulus.isZero) + if modulus.magnitude == 1 { return 0 } + if exponent.isZero { return 1 } + if exponent == 1 { return self.modulus(modulus) } + if exponent < 0 { + precondition(!self.isZero) + guard magnitude == 1 else { return 0 } + guard sign == .minus else { return 1 } + guard exponent.magnitude[0] & 1 != 0 else { return 1 } + return BigInt(modulus.magnitude - 1) + } + let power = self.magnitude.power(exponent.magnitude, + modulus: modulus.magnitude) + if self.sign == .plus || exponent.magnitude[0] & 1 == 0 || power.isZero { + return BigInt(power) + } + return BigInt(modulus.magnitude - power) + } +} diff --git a/Pods/BigInt/sources/Floating Point Conversion.swift b/Pods/BigInt/sources/Floating Point Conversion.swift new file mode 100644 index 0000000..6c2395a --- /dev/null +++ b/Pods/BigInt/sources/Floating Point Conversion.swift @@ -0,0 +1,73 @@ +// +// Floating Point Conversion.swift +// BigInt +// +// Created by Károly Lőrentey on 2017-08-11. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + public init?(exactly source: T) { + guard source.isFinite else { return nil } + guard !source.isZero else { self = 0; return } + guard source.sign == .plus else { return nil } + let value = source.rounded(.towardZero) + guard value == source else { return nil } + assert(value.floatingPointClass == .positiveNormal) + assert(value.exponent >= 0) + let significand = value.significandBitPattern + self = (BigUInt(1) << value.exponent) + BigUInt(significand) >> (T.significandBitCount - Int(value.exponent)) + } + + public init(_ source: T) { + self.init(exactly: source.rounded(.towardZero))! + } +} + +extension BigInt { + public init?(exactly source: T) { + switch source.sign{ + case .plus: + guard let magnitude = BigUInt(exactly: source) else { return nil } + self = BigInt(sign: .plus, magnitude: magnitude) + case .minus: + guard let magnitude = BigUInt(exactly: -source) else { return nil } + self = BigInt(sign: .minus, magnitude: magnitude) + } + } + + public init(_ source: T) { + self.init(exactly: source.rounded(.towardZero))! + } +} + +extension BinaryFloatingPoint where RawExponent: FixedWidthInteger, RawSignificand: FixedWidthInteger { + public init(_ value: BigInt) { + guard !value.isZero else { self = 0; return } + let v = value.magnitude + let bitWidth = v.bitWidth + var exponent = bitWidth - 1 + let shift = bitWidth - Self.significandBitCount - 1 + var significand = value.magnitude >> (shift - 1) + if significand[0] & 3 == 3 { // Handle rounding + significand >>= 1 + significand += 1 + if significand.trailingZeroBitCount >= Self.significandBitCount { + exponent += 1 + } + } + else { + significand >>= 1 + } + let bias = 1 << (Self.exponentBitCount - 1) - 1 + guard exponent <= bias else { self = Self.infinity; return } + significand &= 1 << Self.significandBitCount - 1 + self = Self.init(sign: value.sign == .plus ? .plus : .minus, + exponentBitPattern: RawExponent(bias + exponent), + significandBitPattern: RawSignificand(significand)) + } + + public init(_ value: BigUInt) { + self.init(BigInt(sign: .plus, magnitude: value)) + } +} diff --git a/Pods/BigInt/sources/GCD.swift b/Pods/BigInt/sources/GCD.swift new file mode 100644 index 0000000..d55605d --- /dev/null +++ b/Pods/BigInt/sources/GCD.swift @@ -0,0 +1,80 @@ +// +// GCD.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + //MARK: Greatest Common Divisor + + /// Returns the greatest common divisor of `self` and `b`. + /// + /// - Complexity: O(count^2) where count = max(self.count, b.count) + public func greatestCommonDivisor(with b: BigUInt) -> BigUInt { + // This is Stein's algorithm: https://en.wikipedia.org/wiki/Binary_GCD_algorithm + if self.isZero { return b } + if b.isZero { return self } + + let az = self.trailingZeroBitCount + let bz = b.trailingZeroBitCount + let twos = Swift.min(az, bz) + + var (x, y) = (self >> az, b >> bz) + if x < y { swap(&x, &y) } + + while !x.isZero { + x >>= x.trailingZeroBitCount + if x < y { swap(&x, &y) } + x -= y + } + return y << twos + } + + /// Returns the [multiplicative inverse of this integer in modulo `modulus` arithmetic][inverse], + /// or `nil` if there is no such number. + /// + /// [inverse]: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers + /// + /// - Returns: If `gcd(self, modulus) == 1`, the value returned is an integer `a < modulus` such that `(a * self) % modulus == 1`. If `self` and `modulus` aren't coprime, the return value is `nil`. + /// - Requires: modulus > 1 + /// - Complexity: O(count^3) + public func inverse(_ modulus: BigUInt) -> BigUInt? { + precondition(modulus > 1) + var t1 = BigInt(0) + var t2 = BigInt(1) + var r1 = modulus + var r2 = self + while !r2.isZero { + let quotient = r1 / r2 + (t1, t2) = (t2, t1 - BigInt(quotient) * t2) + (r1, r2) = (r2, r1 - quotient * r2) + } + if r1 > 1 { return nil } + if t1.sign == .minus { return modulus - t1.magnitude } + return t1.magnitude + } +} + +extension BigInt { + /// Returns the greatest common divisor of `a` and `b`. + /// + /// - Complexity: O(count^2) where count = max(a.count, b.count) + public func greatestCommonDivisor(with b: BigInt) -> BigInt { + return BigInt(self.magnitude.greatestCommonDivisor(with: b.magnitude)) + } + + /// Returns the [multiplicative inverse of this integer in modulo `modulus` arithmetic][inverse], + /// or `nil` if there is no such number. + /// + /// [inverse]: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm#Modular_integers + /// + /// - Returns: If `gcd(self, modulus) == 1`, the value returned is an integer `a < modulus` such that `(a * self) % modulus == 1`. If `self` and `modulus` aren't coprime, the return value is `nil`. + /// - Requires: modulus.magnitude > 1 + /// - Complexity: O(count^3) + public func inverse(_ modulus: BigInt) -> BigInt? { + guard let inv = self.magnitude.inverse(modulus.magnitude) else { return nil } + return BigInt(self.sign == .plus || inv.isZero ? inv : modulus.magnitude - inv) + } +} diff --git a/Pods/BigInt/sources/Hashable.swift b/Pods/BigInt/sources/Hashable.swift new file mode 100644 index 0000000..7df0ff7 --- /dev/null +++ b/Pods/BigInt/sources/Hashable.swift @@ -0,0 +1,28 @@ +// +// Hashable.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +import SipHash + +extension BigUInt: SipHashable { + //MARK: Hashing + + /// Append this `BigUInt` to the specified hasher. + public func appendHashes(to hasher: inout SipHasher) { + for word in self.words { + hasher.append(word) + } + } +} + +extension BigInt: SipHashable { + /// Append this `BigInt` to the specified hasher. + public func appendHashes(to hasher: inout SipHasher) { + hasher.append(sign) + hasher.append(magnitude) + } +} diff --git a/Pods/BigInt/sources/Integer Conversion.swift b/Pods/BigInt/sources/Integer Conversion.swift new file mode 100644 index 0000000..9a210e4 --- /dev/null +++ b/Pods/BigInt/sources/Integer Conversion.swift @@ -0,0 +1,89 @@ +// +// Integer Conversion.swift +// BigInt +// +// Created by Károly Lőrentey on 2017-08-11. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + public init?(exactly source: T) { + guard source >= (0 as T) else { return nil } + if source.bitWidth <= 2 * Word.bitWidth { + var it = source.words.makeIterator() + self.init(low: it.next() ?? 0, high: it.next() ?? 0) + precondition(it.next() == nil, "Length of BinaryInteger.words is greater than its bitWidth") + } + else { + self.init(words: source.words) + } + } + + public init(_ source: T) { + precondition(source >= (0 as T), "BigUInt cannot represent negative values") + self.init(exactly: source)! + } + + public init(truncatingIfNeeded source: T) { + self.init(words: source.words) + } + + public init(clamping source: T) { + if source <= (0 as T) { + self.init() + } + else { + self.init(words: source.words) + } + } +} + +extension BigInt { + public init() { + self.init(sign: .plus, magnitude: 0) + } + + /// Initializes a new signed big integer with the same value as the specified unsigned big integer. + public init(_ integer: BigUInt) { + self.magnitude = integer + self.sign = .plus + } + + public init(_ source: T) where T : BinaryInteger { + if source >= (0 as T) { + self.init(sign: .plus, magnitude: BigUInt(source)) + } + else { + var words = Array(source.words) + words.twosComplement() + self.init(sign: .minus, magnitude: BigUInt(words: words)) + } + } + + public init?(exactly source: T) where T : BinaryInteger { + self.init(source) + } + + public init(clamping source: T) where T : BinaryInteger { + self.init(source) + } + + public init(truncatingIfNeeded source: T) where T : BinaryInteger { + self.init(source) + } +} + +extension BigUInt: ExpressibleByIntegerLiteral { + /// Initialize a new big integer from an integer literal. + public init(integerLiteral value: UInt64) { + self.init(value) + } +} + +extension BigInt: ExpressibleByIntegerLiteral { + /// Initialize a new big integer from an integer literal. + public init(integerLiteral value: Int64) { + self.init(value) + } +} + diff --git a/Pods/BigInt/sources/Multiplication.swift b/Pods/BigInt/sources/Multiplication.swift new file mode 100644 index 0000000..635c36a --- /dev/null +++ b/Pods/BigInt/sources/Multiplication.swift @@ -0,0 +1,165 @@ +// +// Multiplication.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + + //MARK: Multiplication + + /// Multiply this big integer by a single word, and store the result in place of the original big integer. + /// + /// - Complexity: O(count) + public mutating func multiply(byWord y: Word) { + guard y != 0 else { self = 0; return } + guard y != 1 else { return } + var carry: Word = 0 + let c = self.count + for i in 0 ..< c { + let (h, l) = self[i].multipliedFullWidth(by: y) + let (low, o) = l.addingReportingOverflow(carry) + self[i] = low + carry = (o ? h + 1 : h) + } + self[c] = carry + } + + /// Multiply this big integer by a single Word, and return the result. + /// + /// - Complexity: O(count) + public func multiplied(byWord y: Word) -> BigUInt { + var r = self + r.multiply(byWord: y) + return r + } + + /// Multiply `x` by `y`, and add the result to this integer, optionally shifted `shift` words to the left. + /// + /// - Note: This is the fused multiply/shift/add operation; it is more efficient than doing the components + /// individually. (The fused operation doesn't need to allocate space for temporary big integers.) + /// - Returns: `self` is set to `self + (x * y) << (shift * 2^Word.bitWidth)` + /// - Complexity: O(count) + public mutating func multiplyAndAdd(_ x: BigUInt, _ y: Word, shiftedBy shift: Int = 0) { + precondition(shift >= 0) + guard y != 0 && x.count > 0 else { return } + guard y != 1 else { self.add(x, shiftedBy: shift); return } + var mulCarry: Word = 0 + var addCarry = false + let xc = x.count + var xi = 0 + while xi < xc || addCarry || mulCarry > 0 { + let (h, l) = x[xi].multipliedFullWidth(by: y) + let (low, o) = l.addingReportingOverflow(mulCarry) + mulCarry = (o ? h + 1 : h) + + let ai = shift + xi + let (sum1, so1) = self[ai].addingReportingOverflow(low) + if addCarry { + let (sum2, so2) = sum1.addingReportingOverflow(1) + self[ai] = sum2 + addCarry = so1 || so2 + } + else { + self[ai] = sum1 + addCarry = so1 + } + xi += 1 + } + } + + /// Multiply this integer by `y` and return the result. + /// + /// - Note: This uses the naive O(n^2) multiplication algorithm unless both arguments have more than + /// `BigUInt.directMultiplicationLimit` words. + /// - Complexity: O(n^log2(3)) + public func multiplied(by y: BigUInt) -> BigUInt { + // This method is mostly defined for symmetry with the rest of the arithmetic operations. + return self * y + } + + /// Multiplication switches to an asymptotically better recursive algorithm when arguments have more words than this limit. + public static var directMultiplicationLimit: Int = 1024 + + /// Multiply `a` by `b` and return the result. + /// + /// - Note: This uses the naive O(n^2) multiplication algorithm unless both arguments have more than + /// `BigUInt.directMultiplicationLimit` words. + /// - Complexity: O(n^log2(3)) + public static func *(x: BigUInt, y: BigUInt) -> BigUInt { + let xc = x.count + let yc = y.count + if xc == 0 { return BigUInt() } + if yc == 0 { return BigUInt() } + if yc == 1 { return x.multiplied(byWord: y[0]) } + if xc == 1 { return y.multiplied(byWord: x[0]) } + + if Swift.min(xc, yc) <= BigUInt.directMultiplicationLimit { + // Long multiplication. + let left = (xc < yc ? y : x) + let right = (xc < yc ? x : y) + var result = BigUInt() + for i in (0 ..< right.count).reversed() { + result.multiplyAndAdd(left, right[i], shiftedBy: i) + } + return result + } + + if yc < xc { + let (xh, xl) = x.split + var r = xl * y + r.add(xh * y, shiftedBy: x.middleIndex) + return r + } + else if xc < yc { + let (yh, yl) = y.split + var r = yl * x + r.add(yh * x, shiftedBy: y.middleIndex) + return r + } + + let shift = x.middleIndex + + // Karatsuba multiplication: + // x * y = * = (ignoring carry) + let (a, b) = x.split + let (c, d) = y.split + + let high = a * c + let low = b * d + let xp = a >= b + let yp = c >= d + let xm = (xp ? a - b : b - a) + let ym = (yp ? c - d : d - c) + let m = xm * ym + + var r = low + r.add(high, shiftedBy: 2 * shift) + r.add(low, shiftedBy: shift) + r.add(high, shiftedBy: shift) + if xp == yp { + r.subtract(m, shiftedBy: shift) + } + else { + r.add(m, shiftedBy: shift) + } + return r + } + + /// Multiply `a` by `b` and store the result in `a`. + public static func *=(a: inout BigUInt, b: BigUInt) { + a = a * b + } +} + +extension BigInt { + /// Multiply `a` with `b` and return the result. + public static func *(a: BigInt, b: BigInt) -> BigInt { + return BigInt(sign: a.sign == b.sign ? .plus : .minus, magnitude: a.magnitude * b.magnitude) + } + + /// Multiply `a` with `b` in place. + public static func *=(a: inout BigInt, b: BigInt) { a = a * b } +} diff --git a/Pods/BigInt/sources/Prime Test.swift b/Pods/BigInt/sources/Prime Test.swift new file mode 100644 index 0000000..7f18711 --- /dev/null +++ b/Pods/BigInt/sources/Prime Test.swift @@ -0,0 +1,153 @@ +// +// Prime Test.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-04. +// Copyright © 2016-2017 Károly Lőrentey. +// + +/// The first several [prime numbers][primes]. +/// +/// [primes]: https://oeis.org/A000040 +let primes: [BigUInt.Word] = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41] + +/// The ith element in this sequence is the smallest composite number that passes the strong probable prime test +/// for all of the first (i+1) primes. +/// +/// This is sequence [A014233](http://oeis.org/A014233) on the [Online Encyclopaedia of Integer Sequences](http://oeis.org). +let pseudoPrimes: [BigUInt] = [ + /* 2 */ 2_047, + /* 3 */ 1_373_653, + /* 5 */ 25_326_001, + /* 7 */ 3_215_031_751, + /* 11 */ 2_152_302_898_747, + /* 13 */ 3_474_749_660_383, + /* 17 */ 341_550_071_728_321, + /* 19 */ 341_550_071_728_321, + /* 23 */ 3_825_123_056_546_413_051, + /* 29 */ 3_825_123_056_546_413_051, + /* 31 */ 3_825_123_056_546_413_051, + /* 37 */ "318665857834031151167461", + /* 41 */ "3317044064679887385961981", +] + +extension BigUInt { + //MARK: Primality Testing + + /// Returns true iff this integer passes the [strong probable prime test][sppt] for the specified base. + /// + /// [sppt]: https://en.wikipedia.org/wiki/Probable_prime + public func isStrongProbablePrime(_ base: BigUInt) -> Bool { + precondition(base > (1 as BigUInt)) + precondition(self > (0 as BigUInt)) + let dec = self - 1 + + let r = dec.trailingZeroBitCount + let d = dec >> r + + var test = base.power(d, modulus: self) + if test == 1 || test == dec { return true } + + if r > 0 { + let shift = self.leadingZeroBitCount + let normalized = self << shift + for _ in 1 ..< r { + test *= test + test.formRemainder(dividingBy: normalized, normalizedBy: shift) + if test == 1 { + return false + } + if test == dec { return true } + } + } + return false + } + + /// Returns true if this integer is probably prime. Returns false if this integer is definitely not prime. + /// + /// This function performs a probabilistic [Miller-Rabin Primality Test][mrpt], consisting of `rounds` iterations, + /// each calculating the strong probable prime test for a random base. The number of rounds is 10 by default, + /// but you may specify your own choice. + /// + /// To speed things up, the function checks if `self` is divisible by the first few prime numbers before + /// diving into (slower) Miller-Rabin testing. + /// + /// Also, when `self` is less than 82 bits wide, `isPrime` does a deterministic test that is guaranteed to + /// return a correct result. + /// + /// [mrpt]: https://en.wikipedia.org/wiki/Miller–Rabin_primality_test + public func isPrime(rounds: Int = 10) -> Bool { + if count <= 1 && self[0] < 2 { return false } + if count == 1 && self[0] < 4 { return true } + + // Even numbers above 2 aren't prime. + if self[0] & 1 == 0 { return false } + + // Quickly check for small primes. + for i in 1 ..< primes.count { + let p = primes[i] + if self.count == 1 && self[0] == p { + return true + } + if self.quotientAndRemainder(dividingByWord: p).remainder == 0 { + return false + } + } + + /// Give an exact answer when we can. + if self < pseudoPrimes.last! { + for i in 0 ..< pseudoPrimes.count { + guard isStrongProbablePrime(BigUInt(primes[i])) else { + break + } + if self < pseudoPrimes[i] { + // `self` is below the lowest pseudoprime corresponding to the prime bases we tested. It's a prime! + return true + } + } + return false + } + + /// Otherwise do as many rounds of random SPPT as required. + for _ in 0 ..< rounds { + let random = BigUInt.randomInteger(lessThan: self - 2) + 2 + guard isStrongProbablePrime(random) else { + return false + } + } + + // Well, it smells primey to me. + return true + } +} + +extension BigInt { + //MARK: Primality Testing + + /// Returns true iff this integer passes the [strong probable prime test][sppt] for the specified base. + /// + /// [sppt]: https://en.wikipedia.org/wiki/Probable_prime + public func isStrongProbablePrime(_ base: BigInt) -> Bool { + precondition(base.sign == .plus) + if self.sign == .minus { return false } + return self.magnitude.isStrongProbablePrime(base.magnitude) + } + + /// Returns true if this integer is probably prime. Returns false if this integer is definitely not prime. + /// + /// This function performs a probabilistic [Miller-Rabin Primality Test][mrpt], consisting of `rounds` iterations, + /// each calculating the strong probable prime test for a random base. The number of rounds is 10 by default, + /// but you may specify your own choice. + /// + /// To speed things up, the function checks if `self` is divisible by the first few prime numbers before + /// diving into (slower) Miller-Rabin testing. + /// + /// Also, when `self` is less than 82 bits wide, `isPrime` does a deterministic test that is guaranteed to + /// return a correct result. + /// + /// [mrpt]: https://en.wikipedia.org/wiki/Miller–Rabin_primality_test + public func isPrime(rounds: Int = 10) -> Bool { + if self.sign == .minus { return false } + return self.magnitude.isPrime(rounds: rounds) + } +} diff --git a/Pods/BigInt/sources/Random.swift b/Pods/BigInt/sources/Random.swift new file mode 100644 index 0000000..5813b4b --- /dev/null +++ b/Pods/BigInt/sources/Random.swift @@ -0,0 +1,71 @@ +// +// Random.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-04. +// Copyright © 2016-2017 Károly Lőrentey. +// + +import Foundation +#if os(Linux) || os(FreeBSD) + import Glibc +#endif + + +extension BigUInt { + //MARK: Random Integers + + /// Create a big integer consisting of `width` uniformly distributed random bits. + /// + /// - Returns: A big integer less than `1 << width`. + /// - Note: This function uses `arc4random_buf` to generate random bits. + public static func randomInteger(withMaximumWidth width: Int) -> BigUInt { + guard width > 0 else { return 0 } + + let byteCount = (width + 7) / 8 + assert(byteCount > 0) + + let buffer = UnsafeMutablePointer.allocate(capacity: byteCount) + #if os(Linux) || os(FreeBSD) + let fd = open("/dev/urandom", O_RDONLY) + defer { + close(fd) + } + let _ = read(fd, buffer, MemoryLayout.size * byteCount) + #else + arc4random_buf(buffer, byteCount) + #endif + if width % 8 != 0 { + buffer[0] &= UInt8(1 << (width % 8) - 1) + } + defer { + buffer.deinitialize(count: byteCount) + buffer.deallocate() + } + return BigUInt(Data(bytesNoCopy: buffer, count: byteCount, deallocator: .none)) + } + + /// Create a big integer consisting of `width-1` uniformly distributed random bits followed by a one bit. + /// + /// - Returns: A random big integer whose width is `width`. + /// - Note: This function uses `arc4random_buf` to generate random bits. + public static func randomInteger(withExactWidth width: Int) -> BigUInt { + guard width > 1 else { return BigUInt(width) } + var result = randomInteger(withMaximumWidth: width - 1) + result[(width - 1) / Word.bitWidth] |= 1 << Word((width - 1) % Word.bitWidth) + return result + } + + /// Create a uniformly distributed random integer that's less than the specified limit. + /// + /// - Returns: A random big integer that is less than `limit`. + /// - Note: This function uses `arc4random_buf` to generate random bits. + public static func randomInteger(lessThan limit: BigUInt) -> BigUInt { + let width = limit.bitWidth + var random = randomInteger(withMaximumWidth: width) + while random >= limit { + random = randomInteger(withMaximumWidth: width) + } + return random + } +} diff --git a/Pods/BigInt/sources/Shifts.swift b/Pods/BigInt/sources/Shifts.swift new file mode 100644 index 0000000..e676e41 --- /dev/null +++ b/Pods/BigInt/sources/Shifts.swift @@ -0,0 +1,211 @@ +// +// Shifts.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + + //MARK: Shift Operators + + internal func shiftedLeft(by amount: Word) -> BigUInt { + guard amount > 0 else { return self } + + let ext = Int(amount / Word(Word.bitWidth)) // External shift amount (new words) + let up = Word(amount % Word(Word.bitWidth)) // Internal shift amount (subword shift) + let down = Word(Word.bitWidth) - up + + var result = BigUInt() + if up > 0 { + var i = 0 + var lowbits: Word = 0 + while i < self.count || lowbits > 0 { + let word = self[i] + result[i + ext] = word << up | lowbits + lowbits = word >> down + i += 1 + } + } + else { + for i in 0 ..< self.count { + result[i + ext] = self[i] + } + } + return result + } + + internal mutating func shiftLeft(by amount: Word) { + guard amount > 0 else { return } + + let ext = Int(amount / Word(Word.bitWidth)) // External shift amount (new words) + let up = Word(amount % Word(Word.bitWidth)) // Internal shift amount (subword shift) + let down = Word(Word.bitWidth) - up + + if up > 0 { + var i = 0 + var lowbits: Word = 0 + while i < self.count || lowbits > 0 { + let word = self[i] + self[i] = word << up | lowbits + lowbits = word >> down + i += 1 + } + } + if ext > 0 && self.count > 0 { + self.shiftLeft(byWords: ext) + } + } + + internal func shiftedRight(by amount: Word) -> BigUInt { + guard amount > 0 else { return self } + guard amount < self.bitWidth else { return 0 } + + let ext = Int(amount / Word(Word.bitWidth)) // External shift amount (new words) + let down = Word(amount % Word(Word.bitWidth)) // Internal shift amount (subword shift) + let up = Word(Word.bitWidth) - down + + var result = BigUInt() + if down > 0 { + var highbits: Word = 0 + for i in (ext ..< self.count).reversed() { + let word = self[i] + result[i - ext] = highbits | word >> down + highbits = word << up + } + } + else { + for i in (ext ..< self.count).reversed() { + result[i - ext] = self[i] + } + } + return result + } + + internal mutating func shiftRight(by amount: Word) { + guard amount > 0 else { return } + guard amount < self.bitWidth else { self.clear(); return } + + let ext = Int(amount / Word(Word.bitWidth)) // External shift amount (new words) + let down = Word(amount % Word(Word.bitWidth)) // Internal shift amount (subword shift) + let up = Word(Word.bitWidth) - down + + if ext > 0 { + self.shiftRight(byWords: ext) + } + if down > 0 { + var i = self.count - 1 + var highbits: Word = 0 + while i >= 0 { + let word = self[i] + self[i] = highbits | word >> down + highbits = word << up + i -= 1 + } + } + } + + public static func >>=(lhs: inout BigUInt, rhs: Other) { + if rhs < (0 as Other) { + lhs <<= (0 - rhs) + } + else if rhs >= lhs.bitWidth { + lhs.clear() + } + else { + lhs.shiftRight(by: UInt(rhs)) + } + } + + public static func <<=(lhs: inout BigUInt, rhs: Other) { + if rhs < (0 as Other) { + lhs >>= (0 - rhs) + return + } + lhs.shiftLeft(by: Word(exactly: rhs)!) + } + + public static func >>(lhs: BigUInt, rhs: Other) -> BigUInt { + if rhs < (0 as Other) { + return lhs << (0 - rhs) + } + if rhs > Word.max { + return 0 + } + return lhs.shiftedRight(by: UInt(rhs)) + } + + public static func <<(lhs: BigUInt, rhs: Other) -> BigUInt { + if rhs < (0 as Other) { + return lhs >> (0 - rhs) + } + return lhs.shiftedLeft(by: Word(exactly: rhs)!) + } +} + +extension BigInt { + func shiftedLeft(by amount: Word) -> BigInt { + return BigInt(sign: self.sign, magnitude: self.magnitude.shiftedLeft(by: amount)) + } + + mutating func shiftLeft(by amount: Word) { + self.magnitude.shiftLeft(by: amount) + } + + func shiftedRight(by amount: Word) -> BigInt { + let m = self.magnitude.shiftedRight(by: amount) + return BigInt(sign: self.sign, magnitude: self.sign == .minus && m.isZero ? 1 : m) + } + + mutating func shiftRight(by amount: Word) { + magnitude.shiftRight(by: amount) + if sign == .minus, magnitude.isZero { + magnitude.load(1) + } + } + + public static func &<<(left: BigInt, right: BigInt) -> BigInt { + return left.shiftedLeft(by: right.words[0]) + } + + public static func &<<=(left: inout BigInt, right: BigInt) { + left.shiftLeft(by: right.words[0]) + } + + public static func &>>(left: BigInt, right: BigInt) -> BigInt { + return left.shiftedRight(by: right.words[0]) + } + + public static func &>>=(left: inout BigInt, right: BigInt) { + left.shiftRight(by: right.words[0]) + } + + public static func <<(lhs: BigInt, rhs: Other) -> BigInt { + guard rhs >= (0 as Other) else { return lhs >> (0 - rhs) } + return lhs.shiftedLeft(by: Word(rhs)) + } + + public static func <<=(lhs: inout BigInt, rhs: Other) { + if rhs < (0 as Other) { + lhs >>= (0 - rhs) + } + else { + lhs.shiftLeft(by: Word(rhs)) + } + } + + public static func >>(lhs: BigInt, rhs: Other) -> BigInt { + guard rhs >= (0 as Other) else { return lhs << (0 - rhs) } + return lhs.shiftedRight(by: Word(rhs)) + } + + public static func >>=(lhs: inout BigInt, rhs: Other) { + if rhs < (0 as Other) { + lhs <<= (0 - rhs) + } + else { + lhs.shiftRight(by: Word(rhs)) + } + } +} diff --git a/Pods/BigInt/sources/Square Root.swift b/Pods/BigInt/sources/Square Root.swift new file mode 100644 index 0000000..68db069 --- /dev/null +++ b/Pods/BigInt/sources/Square Root.swift @@ -0,0 +1,41 @@ +// +// Square Root.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +//MARK: Square Root + +extension BigUInt { + /// Returns the integer square root of a big integer; i.e., the largest integer whose square isn't greater than `value`. + /// + /// - Returns: floor(sqrt(self)) + public func squareRoot() -> BigUInt { + // This implementation uses Newton's method. + guard !self.isZero else { return BigUInt() } + var x = BigUInt(1) << ((self.bitWidth + 1) / 2) + var y: BigUInt = 0 + while true { + y.load(self) + y /= x + y += x + y >>= 1 + if x == y || x == y - 1 { break } + x = y + } + return x + } +} + +extension BigInt { + /// Returns the integer square root of a big integer; i.e., the largest integer whose square isn't greater than `value`. + /// + /// - Requires: self >= 0 + /// - Returns: floor(sqrt(self)) + public func squareRoot() -> BigInt { + precondition(self.sign == .plus) + return BigInt(sign: .plus, magnitude: self.magnitude.squareRoot()) + } +} diff --git a/Pods/BigInt/sources/Strideable.swift b/Pods/BigInt/sources/Strideable.swift new file mode 100644 index 0000000..2b79bab --- /dev/null +++ b/Pods/BigInt/sources/Strideable.swift @@ -0,0 +1,38 @@ +// +// Strideable.swift +// BigInt +// +// Created by Károly Lőrentey on 2017-08-11. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt: Strideable { + /// A type that can represent the distance between two values ofa `BigUInt`. + public typealias Stride = BigInt + + /// Adds `n` to `self` and returns the result. Traps if the result would be less than zero. + public func advanced(by n: BigInt) -> BigUInt { + return n.sign == .minus ? self - n.magnitude : self + n.magnitude + } + + /// Returns the (potentially negative) difference between `self` and `other` as a `BigInt`. Never traps. + public func distance(to other: BigUInt) -> BigInt { + return BigInt(other) - BigInt(self) + } +} + +extension BigInt: Strideable { + public typealias Stride = BigInt + + /// Returns `self + n`. + public func advanced(by n: Stride) -> BigInt { + return self + n + } + + /// Returns `other - self`. + public func distance(to other: BigInt) -> Stride { + return other - self + } +} + + diff --git a/Pods/BigInt/sources/String Conversion.swift b/Pods/BigInt/sources/String Conversion.swift new file mode 100644 index 0000000..02df51e --- /dev/null +++ b/Pods/BigInt/sources/String Conversion.swift @@ -0,0 +1,242 @@ +// +// String Conversion.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + + //MARK: String Conversion + + /// Calculates the number of numerals in a given radix that fit inside a single `Word`. + /// + /// - Returns: (chars, power) where `chars` is highest that satisfy `radix^chars <= 2^Word.bitWidth`. `power` is zero + /// if radix is a power of two; otherwise `power == radix^chars`. + fileprivate static func charsPerWord(forRadix radix: Int) -> (chars: Int, power: Word) { + var power: Word = 1 + var overflow = false + var count = 0 + while !overflow { + let (p, o) = power.multipliedReportingOverflow(by: Word(radix)) + overflow = o + if !o || p == 0 { + count += 1 + power = p + } + } + return (count, power) + } + + /// Initialize a big integer from an ASCII representation in a given radix. Numerals above `9` are represented by + /// letters from the English alphabet. + /// + /// - Requires: `radix > 1 && radix < 36` + /// - Parameter `text`: A string consisting of characters corresponding to numerals in the given radix. (0-9, a-z, A-Z) + /// - Parameter `radix`: The base of the number system to use, or 10 if unspecified. + /// - Returns: The integer represented by `text`, or nil if `text` contains a character that does not represent a numeral in `radix`. + public init?(_ text: String, radix: Int = 10) { + // FIXME Remove this member when SE-0183 is done + self.init(Substring(text), radix: radix) + } + + public init?(_ text: Substring, radix: Int = 10) { + precondition(radix > 1) + let (charsPerWord, power) = BigUInt.charsPerWord(forRadix: radix) + + var words: [Word] = [] + var end = text.endIndex + var start = end + var count = 0 + while start != text.startIndex { + start = text.index(before: start) + count += 1 + if count == charsPerWord { + // FIXME Remove String conversion when SE-0183 is done + guard let d = Word(String(text[start ..< end]), radix: radix) else { return nil } + words.append(d) + end = start + count = 0 + } + } + if start != end { + // FIXME Remove String conversion when SE-0183 is done + guard let d = Word(String(text[start ..< end]), radix: radix) else { return nil } + words.append(d) + } + + if power == 0 { + self.init(words: words) + } + else { + self.init() + for d in words.reversed() { + self.multiply(byWord: power) + self.addWord(d) + } + } + } +} + +extension BigInt { + /// Initialize a big integer from an ASCII representation in a given radix. Numerals above `9` are represented by + /// letters from the English alphabet. + /// + /// - Requires: `radix > 1 && radix < 36` + /// - Parameter `text`: A string optionally starting with "-" or "+" followed by characters corresponding to numerals in the given radix. (0-9, a-z, A-Z) + /// - Parameter `radix`: The base of the number system to use, or 10 if unspecified. + /// - Returns: The integer represented by `text`, or nil if `text` contains a character that does not represent a numeral in `radix`. + public init?(_ text: S, radix: Int = 10) { + self.init(Substring(text), radix: radix) + } + + init?(_ text: Substring, radix: Int = 10) { + var text = text + var sign: Sign = .plus + if text.first == "-" { + sign = .minus + text = text.dropFirst() + } + else if text.first == "+" { + text = text.dropFirst() + } + guard let magnitude = BigUInt(text, radix: radix) else { return nil } + self.magnitude = magnitude + self.sign = sign + } +} + +extension String { + /// Initialize a new string with the base-10 representation of an unsigned big integer. + /// + /// - Complexity: O(v.count^2) + public init(_ v: BigUInt) { self.init(v, radix: 10, uppercase: false) } + + /// Initialize a new string representing an unsigned big integer in the given radix (base). + /// + /// Numerals greater than 9 are represented as letters from the English alphabet, + /// starting with `a` if `uppercase` is false or `A` otherwise. + /// + /// - Requires: radix > 1 && radix <= 36 + /// - Complexity: O(count) when radix is a power of two; otherwise O(count^2). + public init(_ v: BigUInt, radix: Int, uppercase: Bool = false) { + precondition(radix > 1) + let (charsPerWord, power) = BigUInt.charsPerWord(forRadix: radix) + + guard !v.isZero else { self = "0"; return } + + var parts: [String] + if power == 0 { + parts = v.words.map { String($0, radix: radix, uppercase: uppercase) } + } + else { + parts = [] + var rest = v + while !rest.isZero { + let mod = rest.divide(byWord: power) + parts.append(String(mod, radix: radix, uppercase: uppercase)) + } + } + assert(!parts.isEmpty) + + self = "" + var first = true + for part in parts.reversed() { + let zeroes = charsPerWord - part.count + assert(zeroes >= 0) + if !first && zeroes > 0 { + // Insert leading zeroes for mid-Words + self += String(repeating: "0", count: zeroes) + } + first = false + self += part + } + } + + /// Initialize a new string representing a signed big integer in the given radix (base). + /// + /// Numerals greater than 9 are represented as letters from the English alphabet, + /// starting with `a` if `uppercase` is false or `A` otherwise. + /// + /// - Requires: radix > 1 && radix <= 36 + /// - Complexity: O(count) when radix is a power of two; otherwise O(count^2). + public init(_ value: BigInt, radix: Int = 10, uppercase: Bool = false) { + self = String(value.magnitude, radix: radix, uppercase: uppercase) + if value.sign == .minus { + self = "-" + self + } + } +} + +extension BigUInt: ExpressibleByStringLiteral { + /// Initialize a new big integer from a Unicode scalar. + /// The scalar must represent a decimal digit. + public init(unicodeScalarLiteral value: UnicodeScalar) { + self = BigUInt(String(value), radix: 10)! + } + + /// Initialize a new big integer from an extended grapheme cluster. + /// The cluster must consist of a decimal digit. + public init(extendedGraphemeClusterLiteral value: String) { + self = BigUInt(value, radix: 10)! + } + + /// Initialize a new big integer from a decimal number represented by a string literal of arbitrary length. + /// The string must contain only decimal digits. + public init(stringLiteral value: StringLiteralType) { + self = BigUInt(value, radix: 10)! + } +} + +extension BigInt: ExpressibleByStringLiteral { + /// Initialize a new big integer from a Unicode scalar. + /// The scalar must represent a decimal digit. + public init(unicodeScalarLiteral value: UnicodeScalar) { + self = BigInt(String(value), radix: 10)! + } + + /// Initialize a new big integer from an extended grapheme cluster. + /// The cluster must consist of a decimal digit. + public init(extendedGraphemeClusterLiteral value: String) { + self = BigInt(value, radix: 10)! + } + + /// Initialize a new big integer from a decimal number represented by a string literal of arbitrary length. + /// The string must contain only decimal digits. + public init(stringLiteral value: StringLiteralType) { + self = BigInt(value, radix: 10)! + } +} + +extension BigUInt: CustomStringConvertible { + /// Return the decimal representation of this integer. + public var description: String { + return String(self, radix: 10) + } +} + +extension BigInt: CustomStringConvertible { + /// Return the decimal representation of this integer. + public var description: String { + return String(self, radix: 10) + } +} + +extension BigUInt: CustomPlaygroundDisplayConvertible { + + /// Return the playground quick look representation of this integer. + public var playgroundDescription: Any { + let text = String(self) + return text + " (\(self.bitWidth) bits)" + } +} + +extension BigInt: CustomPlaygroundDisplayConvertible { + + /// Return the playground quick look representation of this integer. + public var playgroundDescription: Any { + let text = String(self) + return text + " (\(self.magnitude.bitWidth) bits)" + } +} diff --git a/Pods/BigInt/sources/Subtraction.swift b/Pods/BigInt/sources/Subtraction.swift new file mode 100644 index 0000000..5ac872e --- /dev/null +++ b/Pods/BigInt/sources/Subtraction.swift @@ -0,0 +1,169 @@ +// +// Subtraction.swift +// BigInt +// +// Created by Károly Lőrentey on 2016-01-03. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension BigUInt { + //MARK: Subtraction + + /// Subtract `word` from this integer in place, returning a flag indicating if the operation + /// caused an arithmetic overflow. `word` is shifted `shift` words to the left before being subtracted. + /// + /// - Note: If the result indicates an overflow, then `self` becomes the two's complement of the absolute difference. + /// - Complexity: O(count) + internal mutating func subtractWordReportingOverflow(_ word: Word, shiftedBy shift: Int = 0) -> Bool { + precondition(shift >= 0) + var carry: Word = word + var i = shift + let count = self.count + while carry > 0 && i < count { + let (d, c) = self[i].subtractingReportingOverflow(carry) + self[i] = d + carry = (c ? 1 : 0) + i += 1 + } + return carry > 0 + } + + /// Subtract `word` from this integer, returning the difference and a flag that is true if the operation + /// caused an arithmetic overflow. `word` is shifted `shift` words to the left before being subtracted. + /// + /// - Note: If `overflow` is true, then the returned value is the two's complement of the absolute difference. + /// - Complexity: O(count) + internal func subtractingWordReportingOverflow(_ word: Word, shiftedBy shift: Int = 0) -> (partialValue: BigUInt, overflow: Bool) { + var result = self + let overflow = result.subtractWordReportingOverflow(word, shiftedBy: shift) + return (result, overflow) + } + + /// Subtract a digit `d` from this integer in place. + /// `d` is shifted `shift` digits to the left before being subtracted. + /// + /// - Requires: self >= d * 2^shift + /// - Complexity: O(count) + internal mutating func subtractWord(_ word: Word, shiftedBy shift: Int = 0) { + let overflow = subtractWordReportingOverflow(word, shiftedBy: shift) + precondition(!overflow) + } + + /// Subtract a digit `d` from this integer and return the result. + /// `d` is shifted `shift` digits to the left before being subtracted. + /// + /// - Requires: self >= d * 2^shift + /// - Complexity: O(count) + internal func subtractingWord(_ word: Word, shiftedBy shift: Int = 0) -> BigUInt { + var result = self + result.subtractWord(word, shiftedBy: shift) + return result + } + + /// Subtract `other` from this integer in place, and return a flag indicating if the operation caused an + /// arithmetic overflow. `other` is shifted `shift` digits to the left before being subtracted. + /// + /// - Note: If the result indicates an overflow, then `self` becomes the twos' complement of the absolute difference. + /// - Complexity: O(count) + public mutating func subtractReportingOverflow(_ b: BigUInt, shiftedBy shift: Int = 0) -> Bool { + precondition(shift >= 0) + var carry = false + var bi = 0 + let bc = b.count + let count = self.count + while bi < bc || (shift + bi < count && carry) { + let ai = shift + bi + let (d, c) = self[ai].subtractingReportingOverflow(b[bi]) + if carry { + let (d2, c2) = d.subtractingReportingOverflow(1) + self[ai] = d2 + carry = c || c2 + } + else { + self[ai] = d + carry = c + } + bi += 1 + } + return carry + } + + /// Subtract `other` from this integer, returning the difference and a flag indicating arithmetic overflow. + /// `other` is shifted `shift` digits to the left before being subtracted. + /// + /// - Note: If `overflow` is true, then the result value is the twos' complement of the absolute value of the difference. + /// - Complexity: O(count) + public func subtractingReportingOverflow(_ other: BigUInt, shiftedBy shift: Int) -> (partialValue: BigUInt, overflow: Bool) { + var result = self + let overflow = result.subtractReportingOverflow(other, shiftedBy: shift) + return (result, overflow) + } + + /// Subtracts `other` from `self`, returning the result and a flag indicating arithmetic overflow. + /// + /// - Note: When the operation overflows, then `partialValue` is the twos' complement of the absolute value of the difference. + /// - Complexity: O(count) + public func subtractingReportingOverflow(_ other: BigUInt) -> (partialValue: BigUInt, overflow: Bool) { + return self.subtractingReportingOverflow(other, shiftedBy: 0) + } + + /// Subtract `other` from this integer in place. + /// `other` is shifted `shift` digits to the left before being subtracted. + /// + /// - Requires: self >= other * 2^shift + /// - Complexity: O(count) + public mutating func subtract(_ other: BigUInt, shiftedBy shift: Int = 0) { + let overflow = subtractReportingOverflow(other, shiftedBy: shift) + precondition(!overflow) + } + + /// Subtract `b` from this integer, and return the difference. + /// `b` is shifted `shift` digits to the left before being subtracted. + /// + /// - Requires: self >= b * 2^shift + /// - Complexity: O(count) + public func subtracting(_ other: BigUInt, shiftedBy shift: Int = 0) -> BigUInt { + var result = self + result.subtract(other, shiftedBy: shift) + return result + } + + /// Decrement this integer by one. + /// + /// - Requires: !isZero + /// - Complexity: O(count) + public mutating func decrement(shiftedBy shift: Int = 0) { + self.subtract(1, shiftedBy: shift) + } + + /// Subtract `b` from `a` and return the result. + /// + /// - Requires: a >= b + /// - Complexity: O(a.count) + public static func -(a: BigUInt, b: BigUInt) -> BigUInt { + return a.subtracting(b) + } + + /// Subtract `b` from `a` and store the result in `a`. + /// + /// - Requires: a >= b + /// - Complexity: O(a.count) + public static func -=(a: inout BigUInt, b: BigUInt) { + a.subtract(b) + } +} + +extension BigInt { + public mutating func negate() { + guard !magnitude.isZero else { return } + self.sign = self.sign == .plus ? .minus : .plus + } + + /// Subtract `b` from `a` and return the result. + public static func -(a: BigInt, b: BigInt) -> BigInt { + return a + -b + } + + /// Subtract `b` from `a` in place. + public static func -=(a: inout BigInt, b: BigInt) { a = a - b } +} diff --git a/Pods/BigInt/sources/Words and Bits.swift b/Pods/BigInt/sources/Words and Bits.swift new file mode 100644 index 0000000..040accd --- /dev/null +++ b/Pods/BigInt/sources/Words and Bits.swift @@ -0,0 +1,202 @@ +// +// Words and Bits.swift +// BigInt +// +// Created by Károly Lőrentey on 2017-08-11. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension Array where Element == UInt { + mutating func twosComplement() { + var increment = true + for i in 0 ..< self.count { + if increment { + (self[i], increment) = (~self[i]).addingReportingOverflow(1) + } + else { + self[i] = ~self[i] + } + } + } +} + +extension BigUInt { + public subscript(bitAt index: Int) -> Bool { + get { + precondition(index >= 0) + let (i, j) = index.quotientAndRemainder(dividingBy: Word.bitWidth) + return self[i] & (1 << j) != 0 + } + set { + precondition(index >= 0) + let (i, j) = index.quotientAndRemainder(dividingBy: Word.bitWidth) + if newValue { + self[i] |= 1 << j + } + else { + self[i] &= ~(1 << j) + } + } + } +} + +extension BigUInt { + /// The minimum number of bits required to represent this integer in binary. + /// + /// - Returns: floor(log2(2 * self + 1)) + /// - Complexity: O(1) + public var bitWidth: Int { + guard count > 0 else { return 0 } + return count * Word.bitWidth - self[count - 1].leadingZeroBitCount + } + + /// The number of leading zero bits in the binary representation of this integer in base `2^(Word.bitWidth)`. + /// This is useful when you need to normalize a `BigUInt` such that the top bit of its most significant word is 1. + /// + /// - Note: 0 is considered to have zero leading zero bits. + /// - Returns: A value in `0...(Word.bitWidth - 1)`. + /// - SeeAlso: width + /// - Complexity: O(1) + public var leadingZeroBitCount: Int { + guard count > 0 else { return 0 } + return self[count - 1].leadingZeroBitCount + } + + /// The number of trailing zero bits in the binary representation of this integer. + /// + /// - Note: 0 is considered to have zero trailing zero bits. + /// - Returns: A value in `0...width`. + /// - Complexity: O(count) + public var trailingZeroBitCount: Int { + guard count > 0 else { return 0 } + let i = self.words.index { $0 != 0 }! + return i * Word.bitWidth + self[i].trailingZeroBitCount + } +} + +extension BigInt { + public var bitWidth: Int { + guard !magnitude.isZero else { return 0 } + return magnitude.bitWidth + 1 + } + + public var trailingZeroBitCount: Int { + // Amazingly, this works fine for negative numbers + return magnitude.trailingZeroBitCount + } +} + +extension BigUInt { + public struct Words: RandomAccessCollection { + private let value: BigUInt + + fileprivate init(_ value: BigUInt) { self.value = value } + + public var startIndex: Int { return 0 } + public var endIndex: Int { return value.count } + + public subscript(_ index: Int) -> Word { + return value[index] + } + } + + public var words: Words { return Words(self) } + + public init(words: Words) where Words.Element == Word { + let uc = words.underestimatedCount + if uc > 2 { + self.init(words: Array(words)) + } + else { + var it = words.makeIterator() + guard let w0 = it.next() else { + self.init() + return + } + guard let w1 = it.next() else { + self.init(word: w0) + return + } + if let w2 = it.next() { + var words: [UInt] = [] + words.reserveCapacity(Swift.max(3, uc)) + words.append(w0) + words.append(w1) + words.append(w2) + while let word = it.next() { + words.append(word) + } + self.init(words: words) + } + else { + self.init(low: w0, high: w1) + } + } + } +} + +extension BigInt { + public struct Words: RandomAccessCollection { + public typealias Indices = CountableRange + + private let value: BigInt + private let decrementLimit: Int + + fileprivate init(_ value: BigInt) { + self.value = value + switch value.sign { + case .plus: + self.decrementLimit = 0 + case .minus: + assert(!value.magnitude.isZero) + self.decrementLimit = value.magnitude.words.index(where: { $0 != 0 })! + } + } + + public var count: Int { + switch value.sign { + case .plus: + if let high = value.magnitude.words.last, high >> (Word.bitWidth - 1) != 0 { + return value.magnitude.count + 1 + } + return value.magnitude.count + case .minus: + let high = value.magnitude.words.last! + if high >> (Word.bitWidth - 1) != 0 { + return value.magnitude.count + 1 + } + return value.magnitude.count + } + } + + public var indices: Indices { return 0 ..< count } + public var startIndex: Int { return 0 } + public var endIndex: Int { return count } + + public subscript(_ index: Int) -> UInt { + // Note that indices above `endIndex` are accepted. + if value.sign == .plus { + return value.magnitude[index] + } + if index <= decrementLimit { + return ~(value.magnitude[index] &- 1) + } + return ~value.magnitude[index] + } + } + + public var words: Words { + return Words(self) + } + + public init(words: S) where S.Element == Word { + var words = Array(words) + if (words.last ?? 0) >> (Word.bitWidth - 1) == 0 { + self.init(sign: .plus, magnitude: BigUInt(words: words)) + } + else { + words.twosComplement() + self.init(sign: .minus, magnitude: BigUInt(words: words)) + } + } +} diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..fec4fc2 --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,20 @@ +PODS: + - BigInt (3.1.0): + - SipHash (~> 1.2) + - SipHash (1.2.2) + +DEPENDENCIES: + - BigInt (~> 3.1) + +SPEC REPOS: + https://github.com/cocoapods/specs.git: + - BigInt + - SipHash + +SPEC CHECKSUMS: + BigInt: 76b5dfdfa3e2e478d4ffdf161aeede5502e2742f + SipHash: fad90a4683e420c52ef28063063dbbce248ea6d4 + +PODFILE CHECKSUM: 597335c5c8e18cd37e92413d97d9dc943246349e + +COCOAPODS: 1.5.3 diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..ab2e987 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1582 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0369FA27448903E074B7E8ECB10A83A1 /* Division.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF77257C182CDCADF44190516948592 /* Division.swift */; }; + 0ECF9660BC1912D246E73F6A3E29DDB8 /* Shifts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63429D4D70F2414F440F348E4EADF1B7 /* Shifts.swift */; }; + 0F4E2CC59778C80F42C189530637E71F /* Bitwise Ops.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34F82E23FB418F60C06431AABDF16E2 /* Bitwise Ops.swift */; }; + 0F61E2E4E5BA37EB8911CA329516BB03 /* Pods-EllipticSwift_iOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 403EC6560DBDC9C6FEF33CE39A2D092F /* Pods-EllipticSwift_iOS-dummy.m */; }; + 122FD240AA28AD47FE6FBF59B76DD8B3 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEA864CFD6B80AE4B948921D3E0C74B5 /* Foundation.framework */; }; + 156F1DCF27E81242F449A7EF93B9AC55 /* SipHash-iOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6DB3735CCA5365CBB80451054F687670 /* SipHash-iOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 17C146FBB9860F0BBB5F5271DA77BBD4 /* Subtraction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B04046B1FAEBEDA04E893A0F0BAC51 /* Subtraction.swift */; }; + 1900E558E886CDFCA70F9D074FB2E3E0 /* Pods-EllipticSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 593CE843AA8276F88BC3F654D3D6F0B4 /* Pods-EllipticSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1EC9245FF4D315BC6F4E3E7F657C342C /* SipHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CD41D07E427A2D99289FDEC9C2D7D67 /* SipHash.framework */; }; + 26456BB10F8258FFA6CB0FE44AF779CF /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */; }; + 29F912B450435F5617C4F54AAAFB46C1 /* String Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6D8B436B66605334BAAF89FEF386233 /* String Conversion.swift */; }; + 2A1A6CAE1C616A19C3B89A3AE7D90E22 /* GCD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CAEE85B67BE617B64C4939CCD4F242E /* GCD.swift */; }; + 2A1EAAB18FBC26D6BB01FD4913BCFA15 /* Data Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A1EF2D03CCF71647637805A50C3EA9 /* Data Conversion.swift */; }; + 2C9F3497F191DFC3DF7FCD35012DF906 /* Strideable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB7C12A9D48E393DEB4883B6AEFB86F1 /* Strideable.swift */; }; + 31526676FCCB2B5E1DDCC5ABA499AC8E /* Addition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6D8185C4D01CE6D8656F1FE638F608 /* Addition.swift */; }; + 322DAFDB7BD9962ACB1E7F4974E583A0 /* Addition.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA6D8185C4D01CE6D8656F1FE638F608 /* Addition.swift */; }; + 3914A87CFA5A4D148635D4025083356F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */; }; + 392C36808A67524C73275F47DB05E2BD /* Square Root.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A801DDDC588D16153CDAD0CBAECCD /* Square Root.swift */; }; + 405ADA5619543BC0A5F33A5802C716F4 /* Primitive Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBCCE207305C91E054F11A8BD3EA3DF /* Primitive Types.swift */; }; + 423024E733CE7C936B5E4B83E9803CEA /* Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0EECCF58302BF515296B84312DFA4D9 /* Codable.swift */; }; + 48B3F3097EF861D85D1486F49DA9FD36 /* Shifts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63429D4D70F2414F440F348E4EADF1B7 /* Shifts.swift */; }; + 49B1F602A52B507C53156D8861E2DA25 /* Hashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F1B073D40CA692BCFC0F5BADC12E6BB /* Hashable.swift */; }; + 4C33211C072EF45B032C6C58E2F35ED2 /* SipHash-iOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BA7804C263F6733A5BC2E943397C850 /* SipHash-iOS-dummy.m */; }; + 4EC26F7ACB74A4043D5BE0E7F8713AB8 /* Multiplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3400C00CC38E9B0D3A2E112CF9F67894 /* Multiplication.swift */; }; + 507FF4470A4E9DCCAFD15B0F11BCF630 /* Integer Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067CCF141ED988F0A9A249A1B1E90C60 /* Integer Conversion.swift */; }; + 51631ECC3B705AA03EDE44987D2C85E5 /* SipHash.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0CD41D07E427A2D99289FDEC9C2D7D67 /* SipHash.framework */; }; + 52A2A198AA17ED9B448089865BF41D9F /* BigInt-iOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B1EF21506030D1651EECB7EA81AA575 /* BigInt-iOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 5A5482D01FE415968FB61AC30DE05361 /* Subtraction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16B04046B1FAEBEDA04E893A0F0BAC51 /* Subtraction.swift */; }; + 5F0D1437F9141DC09E51CB7C8483FA8D /* BigInt-macOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = AF238F8DBD911EE7E3C3ECB81E358CD6 /* BigInt-macOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 65805ED1C440004E95440FACC67DDB07 /* SipHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B4B7DD715A45620D762A688E043FEA /* SipHashable.swift */; }; + 6C0158CC3AF0F71276FE68AD128A22B4 /* RandomUInt64.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0FB8460CE66F05DFE87FF34C20C2BB /* RandomUInt64.swift */; }; + 6C2D74E3C39C4AA0D15A2C49D7C8E173 /* Strideable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB7C12A9D48E393DEB4883B6AEFB86F1 /* Strideable.swift */; }; + 6FDA95F3C0F5C62FADB0CD58E2509BD0 /* Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0EECCF58302BF515296B84312DFA4D9 /* Codable.swift */; }; + 702A3E5A15F8A631900194CB71C8A746 /* Floating Point Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F0270D8E35DE46E4EA1C3DD0427FB8D /* Floating Point Conversion.swift */; }; + 716799FE041DA0FA368F89959DC1000F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */; }; + 752CD30647527A03F6582A544E751306 /* Integer Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067CCF141ED988F0A9A249A1B1E90C60 /* Integer Conversion.swift */; }; + 7D0AAC5039821A12F6DE0E0F37F0F3AA /* Pods-EllipticSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B2E18B6E881AA571CA9819B9381D81 /* Pods-EllipticSwift-dummy.m */; }; + 7F47BAA7955E3569E06B6C84179A68E1 /* Pods-EllipticSwiftTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BB843AA4FCDF4A8A08624C8515B3AAD /* Pods-EllipticSwiftTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 869799C2D795FC711AAB9809170E6AFF /* BigUInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7DE0D58AA61250E6427055A66F97C0D /* BigUInt.swift */; }; + 87139BF4BA9A392932684AC102DD12EC /* GCD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CAEE85B67BE617B64C4939CCD4F242E /* GCD.swift */; }; + 89653C42F6C9E0E261D23783398A65D7 /* Multiplication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3400C00CC38E9B0D3A2E112CF9F67894 /* Multiplication.swift */; }; + 89A748124AB30ED698B390EEEDA5FD95 /* SipHasher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 908364BCE7A5A05D245656CEAB8AA22E /* SipHasher.swift */; }; + 9151E76992667C619CC764715A288E7F /* BigInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C942DC36BD8018C5B4E278DC673652E /* BigInt.swift */; }; + 91BD6023659AF83B66A198831CEF7262 /* Prime Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = E37CD02418C6FF582B661641664496A7 /* Prime Test.swift */; }; + 926744BEBB0E01A291DE0E315100DDA3 /* Primitive Types.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FBCCE207305C91E054F11A8BD3EA3DF /* Primitive Types.swift */; }; + 9848884CE8CCF56B1F00B9D91B97A375 /* SipHash-macOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FC41CE2F31307C9F801EBEADD49F0372 /* SipHash-macOS-dummy.m */; }; + 9978421AAF3623D2A587F6048B1FE903 /* Bitwise Ops.swift in Sources */ = {isa = PBXBuildFile; fileRef = F34F82E23FB418F60C06431AABDF16E2 /* Bitwise Ops.swift */; }; + 9EBB64510E7D3522F057841539A2F4C9 /* SipHasher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 908364BCE7A5A05D245656CEAB8AA22E /* SipHasher.swift */; }; + A3A80A4F14B4FD1E4022114D13B1AC41 /* Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = 252A590269EF43DC9D92403E233DE816 /* Random.swift */; }; + A4953A8EF1C7A9B48AC839C730449C48 /* BigUInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7DE0D58AA61250E6427055A66F97C0D /* BigUInt.swift */; }; + ACE96591341279D7A679CA03213529E1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEA864CFD6B80AE4B948921D3E0C74B5 /* Foundation.framework */; }; + AE872792BD3625DA810E4AABAFD757FF /* SipHashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B4B7DD715A45620D762A688E043FEA /* SipHashable.swift */; }; + B1A4E306F41DD07D0987FE455BA0E8F9 /* Words and Bits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE207C92D166B8E636A7597709D2393 /* Words and Bits.swift */; }; + B9960BEA891F5B75DCFE543F47807252 /* Random.swift in Sources */ = {isa = PBXBuildFile; fileRef = 252A590269EF43DC9D92403E233DE816 /* Random.swift */; }; + BC8AA5FB3D42D48B23941955C3646474 /* Prime Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = E37CD02418C6FF582B661641664496A7 /* Prime Test.swift */; }; + BCC50F1DA966FAC16C5C4F64AB5F059A /* BigInt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C942DC36BD8018C5B4E278DC673652E /* BigInt.swift */; }; + BD3D1718F34D819DDC2A57DF0D0CB055 /* Exponentiation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848493EAF59A08FE2BF896A9D0C293CF /* Exponentiation.swift */; }; + C171603843BEA1BAB8392C07D265C66E /* Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F928683E640F6B8A2545DF3BE9C235 /* Comparable.swift */; }; + C1BF8D5C4DEF1F0D44D2B57E35DD0E62 /* Square Root.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68A801DDDC588D16153CDAD0CBAECCD /* Square Root.swift */; }; + C96493E91E92A0DEB056C0104BDD141F /* Words and Bits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DE207C92D166B8E636A7597709D2393 /* Words and Bits.swift */; }; + CC472CAE986FC27CE39CE95662308367 /* String Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6D8B436B66605334BAAF89FEF386233 /* String Conversion.swift */; }; + CDDFA9A9D1B806191266A57559FDDF37 /* BigInt-macOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9263DA5EAF8A5EF1A923E0C9C8CCEA6E /* BigInt-macOS-dummy.m */; }; + D3A50F35D4FA99BC781382C2D77D4852 /* Pods-EllipticSwift_iOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = A4A80A08A38703EE389F6F0FA98D472E /* Pods-EllipticSwift_iOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D645DE293EAC81959CD910A8EFE2AA08 /* Data Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98A1EF2D03CCF71647637805A50C3EA9 /* Data Conversion.swift */; }; + D9D1A3F7B3875998708995F0353AB2C1 /* Floating Point Conversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F0270D8E35DE46E4EA1C3DD0427FB8D /* Floating Point Conversion.swift */; }; + DCFE21F434497969A93BC38D464EC561 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */; }; + E0991D9483E574A6A574FD13D6240EDE /* Exponentiation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848493EAF59A08FE2BF896A9D0C293CF /* Exponentiation.swift */; }; + E1D7C0568FCB391E56FB216932F1E36B /* Hashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F1B073D40CA692BCFC0F5BADC12E6BB /* Hashable.swift */; }; + E3B8F2DEAFCBAD79848101800DB8906F /* BigInt-iOS-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8106A0DA19961403AC94D7847B9B12 /* BigInt-iOS-dummy.m */; }; + E446C2424753254852D94D1A8144D11E /* RandomUInt64.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B0FB8460CE66F05DFE87FF34C20C2BB /* RandomUInt64.swift */; }; + EA0DD065A2B5191E67D65E3B635B3FF1 /* Division.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAF77257C182CDCADF44190516948592 /* Division.swift */; }; + F0D0DF081D60457E9A728447E0F78393 /* Pods-EllipticSwiftTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EA39CDBA424FA971ED69E43B2D5A0AA /* Pods-EllipticSwiftTests-dummy.m */; }; + FBD6148C545C4DE71E1D9CA5D05A2899 /* Comparable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25F928683E640F6B8A2545DF3BE9C235 /* Comparable.swift */; }; + FD57A5DE353DA240175A191F2472D9B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEA864CFD6B80AE4B948921D3E0C74B5 /* Foundation.framework */; }; + FF38503DF072BC2E313DDDF96D01B013 /* SipHash-macOS-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F900CFADE80D81F5066DCDEFDC2F9C /* SipHash-macOS-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 4757A4DB6ED4CC8BC44C4BDCEC77553A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 87621EF7E694514CE3C5A84316E7BC76; + remoteInfo = "SipHash-iOS"; + }; + 4B34BE2C5699A9F01AD85D45CB4F5955 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = D57632D02F765424F9D5C9B43BA02152; + remoteInfo = "Pods-EllipticSwift"; + }; + 8178CC3D86490FB2D83A32F2AA6D295E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = DD491219134342C5B2A77666B9693F7D; + remoteInfo = "SipHash-macOS"; + }; + BE81F54D6CB3335CA5C601C2C850D2FA /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = DD491219134342C5B2A77666B9693F7D; + remoteInfo = "SipHash-macOS"; + }; + BF60F997970F034433E67146377FC475 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 87621EF7E694514CE3C5A84316E7BC76; + remoteInfo = "SipHash-iOS"; + }; + C3FB8585C59E4BCD6B6E3C0C6473C5CC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4AD062C9E10892961D28F49164A57FF2; + remoteInfo = "BigInt-macOS"; + }; + C4B10BA4858C67D03557990C1A3B40B8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 18681F9410FE7F351944C0BCDEDE5A03; + remoteInfo = "BigInt-iOS"; + }; + DF9BCE858761171B1CAF50663686275F /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4AD062C9E10892961D28F49164A57FF2; + remoteInfo = "BigInt-macOS"; + }; + E0E322FB15E731F048AB7194AFD6B852 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = DD491219134342C5B2A77666B9693F7D; + remoteInfo = "SipHash-macOS"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 00F511D80081497F6A8A383913B96B5A /* SipHash.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SipHash.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 0501C374BC89DDB777CC7F4837939C23 /* BigInt-iOS.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "BigInt-iOS.xcconfig"; sourceTree = ""; }; + 067CCF141ED988F0A9A249A1B1E90C60 /* Integer Conversion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Integer Conversion.swift"; path = "sources/Integer Conversion.swift"; sourceTree = ""; }; + 0BB843AA4FCDF4A8A08624C8515B3AAD /* Pods-EllipticSwiftTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-EllipticSwiftTests-umbrella.h"; sourceTree = ""; }; + 0CD41D07E427A2D99289FDEC9C2D7D67 /* SipHash.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SipHash.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 0DE207C92D166B8E636A7597709D2393 /* Words and Bits.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Words and Bits.swift"; path = "sources/Words and Bits.swift"; sourceTree = ""; }; + 0E917424E56DC22E4FC1DAB6617285C5 /* Pods-EllipticSwift-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-EllipticSwift-acknowledgements.markdown"; sourceTree = ""; }; + 0F0270D8E35DE46E4EA1C3DD0427FB8D /* Floating Point Conversion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Floating Point Conversion.swift"; path = "sources/Floating Point Conversion.swift"; sourceTree = ""; }; + 14F3932A808B1A09D33BF18D08BA2322 /* SipHash-iOS.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "SipHash-iOS.xcconfig"; sourceTree = ""; }; + 16B04046B1FAEBEDA04E893A0F0BAC51 /* Subtraction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Subtraction.swift; path = sources/Subtraction.swift; sourceTree = ""; }; + 1E4BB46796FA1F98BF3E17BD31727225 /* Pods-EllipticSwift_iOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-EllipticSwift_iOS.modulemap"; sourceTree = ""; }; + 22B4B7DD715A45620D762A688E043FEA /* SipHashable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SipHashable.swift; path = SipHash/SipHashable.swift; sourceTree = ""; }; + 252A590269EF43DC9D92403E233DE816 /* Random.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Random.swift; path = sources/Random.swift; sourceTree = ""; }; + 25F928683E640F6B8A2545DF3BE9C235 /* Comparable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Comparable.swift; path = sources/Comparable.swift; sourceTree = ""; }; + 2B1EF21506030D1651EECB7EA81AA575 /* BigInt-iOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "BigInt-iOS-umbrella.h"; sourceTree = ""; }; + 2C4E46FE1A6611D26143521A1CFB5721 /* Pods-EllipticSwift_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwift_iOS.release.xcconfig"; sourceTree = ""; }; + 3400C00CC38E9B0D3A2E112CF9F67894 /* Multiplication.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Multiplication.swift; path = sources/Multiplication.swift; sourceTree = ""; }; + 34C8C88A6B44D2D21D4FAB856CEB67A4 /* Pods-EllipticSwiftTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-EllipticSwiftTests.modulemap"; sourceTree = ""; }; + 38F900CFADE80D81F5066DCDEFDC2F9C /* SipHash-macOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SipHash-macOS-umbrella.h"; path = "../SipHash-macOS/SipHash-macOS-umbrella.h"; sourceTree = ""; }; + 3BA7804C263F6733A5BC2E943397C850 /* SipHash-iOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SipHash-iOS-dummy.m"; sourceTree = ""; }; + 3BEAE3C9265937DD884F3A4C6D6E16E6 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../BigInt-macOS/Info.plist"; sourceTree = ""; }; + 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + 3F828E449F6DCE642E2AB071DECD377B /* Pods-EllipticSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-EllipticSwift.modulemap"; sourceTree = ""; }; + 403EC6560DBDC9C6FEF33CE39A2D092F /* Pods-EllipticSwift_iOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-EllipticSwift_iOS-dummy.m"; sourceTree = ""; }; + 44FC539B6F61701DF1F937705468C950 /* BigInt-macOS.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "BigInt-macOS.xcconfig"; path = "../BigInt-macOS/BigInt-macOS.xcconfig"; sourceTree = ""; }; + 4E6EC929C0BF6064919B3C74ACAF1AF1 /* BigInt-macOS-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "BigInt-macOS-prefix.pch"; path = "../BigInt-macOS/BigInt-macOS-prefix.pch"; sourceTree = ""; }; + 4EA39CDBA424FA971ED69E43B2D5A0AA /* Pods-EllipticSwiftTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-EllipticSwiftTests-dummy.m"; sourceTree = ""; }; + 4F1B073D40CA692BCFC0F5BADC12E6BB /* Hashable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Hashable.swift; path = sources/Hashable.swift; sourceTree = ""; }; + 4FBCCE207305C91E054F11A8BD3EA3DF /* Primitive Types.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Primitive Types.swift"; path = "SipHash/Primitive Types.swift"; sourceTree = ""; }; + 593CE843AA8276F88BC3F654D3D6F0B4 /* Pods-EllipticSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-EllipticSwift-umbrella.h"; sourceTree = ""; }; + 5BFDAFE99BDE951B677584D3373F8A85 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 5CAEE85B67BE617B64C4939CCD4F242E /* GCD.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GCD.swift; path = sources/GCD.swift; sourceTree = ""; }; + 600909A66F6239A611723012BCBC6CC3 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6010045CBDE98A7FAE6F9734655E611B /* Pods-EllipticSwift_iOS-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-EllipticSwift_iOS-acknowledgements.plist"; sourceTree = ""; }; + 61137C42151CE8DDA5C6C632C229ED68 /* SipHash-iOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "SipHash-iOS.modulemap"; sourceTree = ""; }; + 63429D4D70F2414F440F348E4EADF1B7 /* Shifts.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Shifts.swift; path = sources/Shifts.swift; sourceTree = ""; }; + 6409E2C5C3A9954DB1324B904BED1A7E /* Pods-EllipticSwiftTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-EllipticSwiftTests-frameworks.sh"; sourceTree = ""; }; + 66182AD0DC7FB61366F8120537F2DD5E /* Pods_EllipticSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 684B2C2F1B67B215F3B5C0AC34C417AB /* Pods-EllipticSwift_iOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwift_iOS.debug.xcconfig"; sourceTree = ""; }; + 6856762E871E5F7133100D0CB1360177 /* BigInt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BigInt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6D4DDAABFEF041160810F4D3995E5FAE /* Pods-EllipticSwiftTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwiftTests.release.xcconfig"; sourceTree = ""; }; + 6DB3735CCA5365CBB80451054F687670 /* SipHash-iOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SipHash-iOS-umbrella.h"; sourceTree = ""; }; + 6DDA7FCFA90BA304C53D8236CE9FF4B2 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 6DE2D26552DB1E8D54582A1980CE4056 /* Pods-EllipticSwift-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-EllipticSwift-resources.sh"; sourceTree = ""; }; + 7B0FB8460CE66F05DFE87FF34C20C2BB /* RandomUInt64.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RandomUInt64.swift; path = SipHash/RandomUInt64.swift; sourceTree = ""; }; + 7C9B700709B416CA5A48846E7477CEE4 /* BigInt.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BigInt.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7FE223917EE3CAFAAC062EF244D5FC65 /* Pods-EllipticSwift_iOS-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-EllipticSwift_iOS-acknowledgements.markdown"; sourceTree = ""; }; + 808A825A5278F82E394248CEA206FE8A /* SipHash-macOS-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "SipHash-macOS-prefix.pch"; path = "../SipHash-macOS/SipHash-macOS-prefix.pch"; sourceTree = ""; }; + 8427239576A918FDBCFA1D76F3FB5041 /* SipHash-macOS.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "SipHash-macOS.xcconfig"; path = "../SipHash-macOS/SipHash-macOS.xcconfig"; sourceTree = ""; }; + 848493EAF59A08FE2BF896A9D0C293CF /* Exponentiation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Exponentiation.swift; path = sources/Exponentiation.swift; sourceTree = ""; }; + 8980C9F5692969C53550ADAFC1FB4DD6 /* Pods-EllipticSwiftTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-EllipticSwiftTests-acknowledgements.markdown"; sourceTree = ""; }; + 8C942DC36BD8018C5B4E278DC673652E /* BigInt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BigInt.swift; path = sources/BigInt.swift; sourceTree = ""; }; + 908364BCE7A5A05D245656CEAB8AA22E /* SipHasher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SipHasher.swift; path = SipHash/SipHasher.swift; sourceTree = ""; }; + 919BBF814DC5585565029C620191C007 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9263DA5EAF8A5EF1A923E0C9C8CCEA6E /* BigInt-macOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "BigInt-macOS-dummy.m"; path = "../BigInt-macOS/BigInt-macOS-dummy.m"; sourceTree = ""; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 98A1EF2D03CCF71647637805A50C3EA9 /* Data Conversion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Data Conversion.swift"; path = "sources/Data Conversion.swift"; sourceTree = ""; }; + 9B86D56D5519EA60B44C9EE6D7349D6B /* SipHash.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SipHash.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9BF7D0A3FB7223F35665BE2E1E2959B4 /* Pods-EllipticSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwift.release.xcconfig"; sourceTree = ""; }; + A3E4C46C173132AC6ACFCAD985FF9D4E /* Pods_EllipticSwift_iOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwift_iOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A4A80A08A38703EE389F6F0FA98D472E /* Pods-EllipticSwift_iOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-EllipticSwift_iOS-umbrella.h"; sourceTree = ""; }; + A9B2E18B6E881AA571CA9819B9381D81 /* Pods-EllipticSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-EllipticSwift-dummy.m"; sourceTree = ""; }; + AA6D8185C4D01CE6D8656F1FE638F608 /* Addition.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Addition.swift; path = sources/Addition.swift; sourceTree = ""; }; + AF238F8DBD911EE7E3C3ECB81E358CD6 /* BigInt-macOS-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "BigInt-macOS-umbrella.h"; path = "../BigInt-macOS/BigInt-macOS-umbrella.h"; sourceTree = ""; }; + B1183913CAABBEA6ED99B02B57FC4E5E /* Pods-EllipticSwiftTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-EllipticSwiftTests-resources.sh"; sourceTree = ""; }; + B2FCF5449455A0E2216C2A8BD13F249D /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B30E117A552D253760327B7A6CEBB941 /* Pods-EllipticSwift_iOS-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-EllipticSwift_iOS-resources.sh"; sourceTree = ""; }; + B6D8B436B66605334BAAF89FEF386233 /* String Conversion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String Conversion.swift"; path = "sources/String Conversion.swift"; sourceTree = ""; }; + B7CC80F4B8E3BF9F7128A27D4BCDFFCA /* SipHash-iOS-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SipHash-iOS-prefix.pch"; sourceTree = ""; }; + B7DE0D58AA61250E6427055A66F97C0D /* BigUInt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BigUInt.swift; path = sources/BigUInt.swift; sourceTree = ""; }; + BD51264FCF89B43A36C1999FA483DDB6 /* Pods-EllipticSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwift.debug.xcconfig"; sourceTree = ""; }; + BE6EADB8734F0A6AE8DA4478E595289C /* BigInt-macOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; name = "BigInt-macOS.modulemap"; path = "../BigInt-macOS/BigInt-macOS.modulemap"; sourceTree = ""; }; + C0EECCF58302BF515296B84312DFA4D9 /* Codable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Codable.swift; path = sources/Codable.swift; sourceTree = ""; }; + C2C1BC929DF0D3F1CF113C7C01EC118D /* SipHash-macOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; name = "SipHash-macOS.modulemap"; path = "../SipHash-macOS/SipHash-macOS.modulemap"; sourceTree = ""; }; + CB7C12A9D48E393DEB4883B6AEFB86F1 /* Strideable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Strideable.swift; path = sources/Strideable.swift; sourceTree = ""; }; + CE8106A0DA19961403AC94D7847B9B12 /* BigInt-iOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "BigInt-iOS-dummy.m"; sourceTree = ""; }; + D68A801DDDC588D16153CDAD0CBAECCD /* Square Root.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Square Root.swift"; path = "sources/Square Root.swift"; sourceTree = ""; }; + DAF77257C182CDCADF44190516948592 /* Division.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Division.swift; path = sources/Division.swift; sourceTree = ""; }; + DF457BB87F97786574CCEB47C4E3A411 /* Pods-EllipticSwiftTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-EllipticSwiftTests-acknowledgements.plist"; sourceTree = ""; }; + E37CD02418C6FF582B661641664496A7 /* Prime Test.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Prime Test.swift"; path = "sources/Prime Test.swift"; sourceTree = ""; }; + E4ADB80B371838942188B0268EC81B2F /* Pods-EllipticSwift-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-EllipticSwift-acknowledgements.plist"; sourceTree = ""; }; + EEA864CFD6B80AE4B948921D3E0C74B5 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + EF20A23269AA2A91E4B99ACD537ED802 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; name = Info.plist; path = "../SipHash-macOS/Info.plist"; sourceTree = ""; }; + EF514ED2270473AD03F12AE3CD425518 /* Pods-EllipticSwiftTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-EllipticSwiftTests.debug.xcconfig"; sourceTree = ""; }; + F04AA35F16B4B701C9A8ABE228DA52B7 /* Pods_EllipticSwiftTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EllipticSwiftTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F34F82E23FB418F60C06431AABDF16E2 /* Bitwise Ops.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Bitwise Ops.swift"; path = "sources/Bitwise Ops.swift"; sourceTree = ""; }; + F468F95AF373EB66E56D437638D8915E /* BigInt-iOS-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "BigInt-iOS-prefix.pch"; sourceTree = ""; }; + FC41CE2F31307C9F801EBEADD49F0372 /* SipHash-macOS-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "SipHash-macOS-dummy.m"; path = "../SipHash-macOS/SipHash-macOS-dummy.m"; sourceTree = ""; }; + FF0189CA01944AF8ACF5E406A7162A7F /* BigInt-iOS.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "BigInt-iOS.modulemap"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 30F9549C764E0C109EEE77156AF8E0B3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 716799FE041DA0FA368F89959DC1000F /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4D9E2A1BBC69B0BF3CD17AA6B92ABF7F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 122FD240AA28AD47FE6FBF59B76DD8B3 /* Foundation.framework in Frameworks */, + 1EC9245FF4D315BC6F4E3E7F657C342C /* SipHash.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 60A4B9A157E9E1A9E555AE7D4FB40A3F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ACE96591341279D7A679CA03213529E1 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8017792865CE47E0A3E6479E5D5CB035 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 3914A87CFA5A4D148635D4025083356F /* Cocoa.framework in Frameworks */, + 51631ECC3B705AA03EDE44987D2C85E5 /* SipHash.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A0111BFB09D3F0A1A56AF06551BAB85A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 26456BB10F8258FFA6CB0FE44AF779CF /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A019460A5CA60E37710247539905C9D1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FD57A5DE353DA240175A191F2472D9B1 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C5E55FCF862270B0901E5CC5A9EE67B7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + DCFE21F434497969A93BC38D464EC561 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0CD5AE3CDBD94865E4E631B55938F659 /* iOS */ = { + isa = PBXGroup; + children = ( + EEA864CFD6B80AE4B948921D3E0C74B5 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + 2141505DCE1573D02001E02B0439FCC1 /* BigInt */ = { + isa = PBXGroup; + children = ( + AA6D8185C4D01CE6D8656F1FE638F608 /* Addition.swift */, + 8C942DC36BD8018C5B4E278DC673652E /* BigInt.swift */, + B7DE0D58AA61250E6427055A66F97C0D /* BigUInt.swift */, + F34F82E23FB418F60C06431AABDF16E2 /* Bitwise Ops.swift */, + C0EECCF58302BF515296B84312DFA4D9 /* Codable.swift */, + 25F928683E640F6B8A2545DF3BE9C235 /* Comparable.swift */, + 98A1EF2D03CCF71647637805A50C3EA9 /* Data Conversion.swift */, + DAF77257C182CDCADF44190516948592 /* Division.swift */, + 848493EAF59A08FE2BF896A9D0C293CF /* Exponentiation.swift */, + 0F0270D8E35DE46E4EA1C3DD0427FB8D /* Floating Point Conversion.swift */, + 5CAEE85B67BE617B64C4939CCD4F242E /* GCD.swift */, + 4F1B073D40CA692BCFC0F5BADC12E6BB /* Hashable.swift */, + 067CCF141ED988F0A9A249A1B1E90C60 /* Integer Conversion.swift */, + 3400C00CC38E9B0D3A2E112CF9F67894 /* Multiplication.swift */, + E37CD02418C6FF582B661641664496A7 /* Prime Test.swift */, + 252A590269EF43DC9D92403E233DE816 /* Random.swift */, + 63429D4D70F2414F440F348E4EADF1B7 /* Shifts.swift */, + D68A801DDDC588D16153CDAD0CBAECCD /* Square Root.swift */, + CB7C12A9D48E393DEB4883B6AEFB86F1 /* Strideable.swift */, + B6D8B436B66605334BAAF89FEF386233 /* String Conversion.swift */, + 16B04046B1FAEBEDA04E893A0F0BAC51 /* Subtraction.swift */, + 0DE207C92D166B8E636A7597709D2393 /* Words and Bits.swift */, + 73396E9EF02EE84714C58F8B23CE5B4F /* Support Files */, + ); + path = BigInt; + sourceTree = ""; + }; + 2B701593A629588685F1F47BE9587884 /* Pods-EllipticSwiftTests */ = { + isa = PBXGroup; + children = ( + 5BFDAFE99BDE951B677584D3373F8A85 /* Info.plist */, + 34C8C88A6B44D2D21D4FAB856CEB67A4 /* Pods-EllipticSwiftTests.modulemap */, + 8980C9F5692969C53550ADAFC1FB4DD6 /* Pods-EllipticSwiftTests-acknowledgements.markdown */, + DF457BB87F97786574CCEB47C4E3A411 /* Pods-EllipticSwiftTests-acknowledgements.plist */, + 4EA39CDBA424FA971ED69E43B2D5A0AA /* Pods-EllipticSwiftTests-dummy.m */, + 6409E2C5C3A9954DB1324B904BED1A7E /* Pods-EllipticSwiftTests-frameworks.sh */, + B1183913CAABBEA6ED99B02B57FC4E5E /* Pods-EllipticSwiftTests-resources.sh */, + 0BB843AA4FCDF4A8A08624C8515B3AAD /* Pods-EllipticSwiftTests-umbrella.h */, + EF514ED2270473AD03F12AE3CD425518 /* Pods-EllipticSwiftTests.debug.xcconfig */, + 6D4DDAABFEF041160810F4D3995E5FAE /* Pods-EllipticSwiftTests.release.xcconfig */, + ); + name = "Pods-EllipticSwiftTests"; + path = "Target Support Files/Pods-EllipticSwiftTests"; + sourceTree = ""; + }; + 41CC4A16C13C9952F7B686722B512A8B /* OS X */ = { + isa = PBXGroup; + children = ( + 3C9D47AE94870CB93E8CEDC1E1FCE815 /* Cocoa.framework */, + ); + name = "OS X"; + sourceTree = ""; + }; + 73396E9EF02EE84714C58F8B23CE5B4F /* Support Files */ = { + isa = PBXGroup; + children = ( + FF0189CA01944AF8ACF5E406A7162A7F /* BigInt-iOS.modulemap */, + 0501C374BC89DDB777CC7F4837939C23 /* BigInt-iOS.xcconfig */, + CE8106A0DA19961403AC94D7847B9B12 /* BigInt-iOS-dummy.m */, + F468F95AF373EB66E56D437638D8915E /* BigInt-iOS-prefix.pch */, + 2B1EF21506030D1651EECB7EA81AA575 /* BigInt-iOS-umbrella.h */, + BE6EADB8734F0A6AE8DA4478E595289C /* BigInt-macOS.modulemap */, + 44FC539B6F61701DF1F937705468C950 /* BigInt-macOS.xcconfig */, + 9263DA5EAF8A5EF1A923E0C9C8CCEA6E /* BigInt-macOS-dummy.m */, + 4E6EC929C0BF6064919B3C74ACAF1AF1 /* BigInt-macOS-prefix.pch */, + AF238F8DBD911EE7E3C3ECB81E358CD6 /* BigInt-macOS-umbrella.h */, + 919BBF814DC5585565029C620191C007 /* Info.plist */, + 3BEAE3C9265937DD884F3A4C6D6E16E6 /* Info.plist */, + ); + name = "Support Files"; + path = "../Target Support Files/BigInt-iOS"; + sourceTree = ""; + }; + 789BA3A2D0B1835E9B1B02380CAC9D43 /* Pods-EllipticSwift_iOS */ = { + isa = PBXGroup; + children = ( + B2FCF5449455A0E2216C2A8BD13F249D /* Info.plist */, + 1E4BB46796FA1F98BF3E17BD31727225 /* Pods-EllipticSwift_iOS.modulemap */, + 7FE223917EE3CAFAAC062EF244D5FC65 /* Pods-EllipticSwift_iOS-acknowledgements.markdown */, + 6010045CBDE98A7FAE6F9734655E611B /* Pods-EllipticSwift_iOS-acknowledgements.plist */, + 403EC6560DBDC9C6FEF33CE39A2D092F /* Pods-EllipticSwift_iOS-dummy.m */, + B30E117A552D253760327B7A6CEBB941 /* Pods-EllipticSwift_iOS-resources.sh */, + A4A80A08A38703EE389F6F0FA98D472E /* Pods-EllipticSwift_iOS-umbrella.h */, + 684B2C2F1B67B215F3B5C0AC34C417AB /* Pods-EllipticSwift_iOS.debug.xcconfig */, + 2C4E46FE1A6611D26143521A1CFB5721 /* Pods-EllipticSwift_iOS.release.xcconfig */, + ); + name = "Pods-EllipticSwift_iOS"; + path = "Target Support Files/Pods-EllipticSwift_iOS"; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, + 7E863D11027B3BEF17B1532C96FFE4F7 /* Frameworks */, + FF2F0FDAACDEBF61E4C8D82549A4D29B /* Pods */, + 872444DDCE671286B85841E678F62BD1 /* Products */, + ED82A8223672C9F414AE7237FC1DEE02 /* Targets Support Files */, + ); + sourceTree = ""; + }; + 7E863D11027B3BEF17B1532C96FFE4F7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 0CD41D07E427A2D99289FDEC9C2D7D67 /* SipHash.framework */, + 0CD5AE3CDBD94865E4E631B55938F659 /* iOS */, + 41CC4A16C13C9952F7B686722B512A8B /* OS X */, + ); + name = Frameworks; + sourceTree = ""; + }; + 872444DDCE671286B85841E678F62BD1 /* Products */ = { + isa = PBXGroup; + children = ( + 7C9B700709B416CA5A48846E7477CEE4 /* BigInt.framework */, + 6856762E871E5F7133100D0CB1360177 /* BigInt.framework */, + 66182AD0DC7FB61366F8120537F2DD5E /* Pods_EllipticSwift.framework */, + A3E4C46C173132AC6ACFCAD985FF9D4E /* Pods_EllipticSwift_iOS.framework */, + F04AA35F16B4B701C9A8ABE228DA52B7 /* Pods_EllipticSwiftTests.framework */, + 00F511D80081497F6A8A383913B96B5A /* SipHash.framework */, + 9B86D56D5519EA60B44C9EE6D7349D6B /* SipHash.framework */, + ); + name = Products; + sourceTree = ""; + }; + 88EB1CE443BA4BA3F920B24BE781E3A3 /* Support Files */ = { + isa = PBXGroup; + children = ( + 6DDA7FCFA90BA304C53D8236CE9FF4B2 /* Info.plist */, + EF20A23269AA2A91E4B99ACD537ED802 /* Info.plist */, + 61137C42151CE8DDA5C6C632C229ED68 /* SipHash-iOS.modulemap */, + 14F3932A808B1A09D33BF18D08BA2322 /* SipHash-iOS.xcconfig */, + 3BA7804C263F6733A5BC2E943397C850 /* SipHash-iOS-dummy.m */, + B7CC80F4B8E3BF9F7128A27D4BCDFFCA /* SipHash-iOS-prefix.pch */, + 6DB3735CCA5365CBB80451054F687670 /* SipHash-iOS-umbrella.h */, + C2C1BC929DF0D3F1CF113C7C01EC118D /* SipHash-macOS.modulemap */, + 8427239576A918FDBCFA1D76F3FB5041 /* SipHash-macOS.xcconfig */, + FC41CE2F31307C9F801EBEADD49F0372 /* SipHash-macOS-dummy.m */, + 808A825A5278F82E394248CEA206FE8A /* SipHash-macOS-prefix.pch */, + 38F900CFADE80D81F5066DCDEFDC2F9C /* SipHash-macOS-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/SipHash-iOS"; + sourceTree = ""; + }; + CDC92BE4CF207167534C90CEEA96315B /* SipHash */ = { + isa = PBXGroup; + children = ( + 4FBCCE207305C91E054F11A8BD3EA3DF /* Primitive Types.swift */, + 7B0FB8460CE66F05DFE87FF34C20C2BB /* RandomUInt64.swift */, + 22B4B7DD715A45620D762A688E043FEA /* SipHashable.swift */, + 908364BCE7A5A05D245656CEAB8AA22E /* SipHasher.swift */, + 88EB1CE443BA4BA3F920B24BE781E3A3 /* Support Files */, + ); + path = SipHash; + sourceTree = ""; + }; + ED82A8223672C9F414AE7237FC1DEE02 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + FEDEF60CFD21662F9330E3F3B8537019 /* Pods-EllipticSwift */, + 789BA3A2D0B1835E9B1B02380CAC9D43 /* Pods-EllipticSwift_iOS */, + 2B701593A629588685F1F47BE9587884 /* Pods-EllipticSwiftTests */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + FEDEF60CFD21662F9330E3F3B8537019 /* Pods-EllipticSwift */ = { + isa = PBXGroup; + children = ( + 600909A66F6239A611723012BCBC6CC3 /* Info.plist */, + 3F828E449F6DCE642E2AB071DECD377B /* Pods-EllipticSwift.modulemap */, + 0E917424E56DC22E4FC1DAB6617285C5 /* Pods-EllipticSwift-acknowledgements.markdown */, + E4ADB80B371838942188B0268EC81B2F /* Pods-EllipticSwift-acknowledgements.plist */, + A9B2E18B6E881AA571CA9819B9381D81 /* Pods-EllipticSwift-dummy.m */, + 6DE2D26552DB1E8D54582A1980CE4056 /* Pods-EllipticSwift-resources.sh */, + 593CE843AA8276F88BC3F654D3D6F0B4 /* Pods-EllipticSwift-umbrella.h */, + BD51264FCF89B43A36C1999FA483DDB6 /* Pods-EllipticSwift.debug.xcconfig */, + 9BF7D0A3FB7223F35665BE2E1E2959B4 /* Pods-EllipticSwift.release.xcconfig */, + ); + name = "Pods-EllipticSwift"; + path = "Target Support Files/Pods-EllipticSwift"; + sourceTree = ""; + }; + FF2F0FDAACDEBF61E4C8D82549A4D29B /* Pods */ = { + isa = PBXGroup; + children = ( + 2141505DCE1573D02001E02B0439FCC1 /* BigInt */, + CDC92BE4CF207167534C90CEEA96315B /* SipHash */, + ); + name = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 42C4CA3182BCE6E6C95263684A2C789D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + FF38503DF072BC2E313DDDF96D01B013 /* SipHash-macOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 69FB8108B52271C4864BBF8BB49FE7CC /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F0D1437F9141DC09E51CB7C8483FA8D /* BigInt-macOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6FB1DF286B2912AE56581DA4CE385088 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 52A2A198AA17ED9B448089865BF41D9F /* BigInt-iOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 8123502FA61760F7427A332C52968CFE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 156F1DCF27E81242F449A7EF93B9AC55 /* SipHash-iOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + B2F32D87999A70DDADA3B599610CB3E7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1900E558E886CDFCA70F9D074FB2E3E0 /* Pods-EllipticSwift-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D99D28FDB46293DA4AB7762DDCFC53CC /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D3A50F35D4FA99BC781382C2D77D4852 /* Pods-EllipticSwift_iOS-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + DB4DED158C829F999FA00D69CACDEF40 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 7F47BAA7955E3569E06B6C84179A68E1 /* Pods-EllipticSwiftTests-umbrella.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 18681F9410FE7F351944C0BCDEDE5A03 /* BigInt-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = BF30E2F3AFCBFA2BD83765273E94FE80 /* Build configuration list for PBXNativeTarget "BigInt-iOS" */; + buildPhases = ( + 09C360BE18772A72928E69C8C2DAE615 /* Sources */, + 4D9E2A1BBC69B0BF3CD17AA6B92ABF7F /* Frameworks */, + 6FB1DF286B2912AE56581DA4CE385088 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + A303B202CB295329FE05D10292E940AB /* PBXTargetDependency */, + ); + name = "BigInt-iOS"; + productName = "BigInt-iOS"; + productReference = 7C9B700709B416CA5A48846E7477CEE4 /* BigInt.framework */; + productType = "com.apple.product-type.framework"; + }; + 2173037F0623FCA446AAB500E0159309 /* Pods-EllipticSwift_iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 41D2DD9C4BEE98C4B0C26DB90D5C471E /* Build configuration list for PBXNativeTarget "Pods-EllipticSwift_iOS" */; + buildPhases = ( + 1BAB3F7ABE5E461C8DB9714564FE4AC1 /* Sources */, + 60A4B9A157E9E1A9E555AE7D4FB40A3F /* Frameworks */, + D99D28FDB46293DA4AB7762DDCFC53CC /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + B7E4FAFA348987BEC887C9D200CF72AC /* PBXTargetDependency */, + DB13138D76F80A4A60C1CD0BB53B95D0 /* PBXTargetDependency */, + ); + name = "Pods-EllipticSwift_iOS"; + productName = "Pods-EllipticSwift_iOS"; + productReference = A3E4C46C173132AC6ACFCAD985FF9D4E /* Pods_EllipticSwift_iOS.framework */; + productType = "com.apple.product-type.framework"; + }; + 4AD062C9E10892961D28F49164A57FF2 /* BigInt-macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = C1BCB594B353DDB57B472C32761BCF0D /* Build configuration list for PBXNativeTarget "BigInt-macOS" */; + buildPhases = ( + 1B9BC1FE8156B6B6DE8D2224B12FC956 /* Sources */, + 8017792865CE47E0A3E6479E5D5CB035 /* Frameworks */, + 69FB8108B52271C4864BBF8BB49FE7CC /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + D05934A6B79692F9FAF89D69D6524797 /* PBXTargetDependency */, + ); + name = "BigInt-macOS"; + productName = "BigInt-macOS"; + productReference = 6856762E871E5F7133100D0CB1360177 /* BigInt.framework */; + productType = "com.apple.product-type.framework"; + }; + 6F500F9FD6FA8C6FB58CA54A9409B73D /* Pods-EllipticSwiftTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2BB211B05B81AB0549FFBE1B732A7FE3 /* Build configuration list for PBXNativeTarget "Pods-EllipticSwiftTests" */; + buildPhases = ( + 3692DFA65B757CE7A5C3D152360A3AB3 /* Sources */, + A0111BFB09D3F0A1A56AF06551BAB85A /* Frameworks */, + DB4DED158C829F999FA00D69CACDEF40 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ECCFDFF5FF9D29D8422726D36F2A10F2 /* PBXTargetDependency */, + E1ED36E611B3EA44D3CB19D163DF2173 /* PBXTargetDependency */, + 73F18F9263C01CC77587FCE37641D0EA /* PBXTargetDependency */, + ); + name = "Pods-EllipticSwiftTests"; + productName = "Pods-EllipticSwiftTests"; + productReference = F04AA35F16B4B701C9A8ABE228DA52B7 /* Pods_EllipticSwiftTests.framework */; + productType = "com.apple.product-type.framework"; + }; + 87621EF7E694514CE3C5A84316E7BC76 /* SipHash-iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5B77C358650A251FAEEFEEF799D7F6BB /* Build configuration list for PBXNativeTarget "SipHash-iOS" */; + buildPhases = ( + 59FC05E62BA1CDE194A3A4595F39B348 /* Sources */, + A019460A5CA60E37710247539905C9D1 /* Frameworks */, + 8123502FA61760F7427A332C52968CFE /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SipHash-iOS"; + productName = "SipHash-iOS"; + productReference = 00F511D80081497F6A8A383913B96B5A /* SipHash.framework */; + productType = "com.apple.product-type.framework"; + }; + D57632D02F765424F9D5C9B43BA02152 /* Pods-EllipticSwift */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9FEEFB21924E0328DC9615BC9FA29153 /* Build configuration list for PBXNativeTarget "Pods-EllipticSwift" */; + buildPhases = ( + 74506231928FEB11E1D9F0D3B2780276 /* Sources */, + C5E55FCF862270B0901E5CC5A9EE67B7 /* Frameworks */, + B2F32D87999A70DDADA3B599610CB3E7 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + B2A45EE11E6E3AF2BA2E2C35AB4CFEC4 /* PBXTargetDependency */, + EFF715EB07792D99C34897A5793D5DB7 /* PBXTargetDependency */, + ); + name = "Pods-EllipticSwift"; + productName = "Pods-EllipticSwift"; + productReference = 66182AD0DC7FB61366F8120537F2DD5E /* Pods_EllipticSwift.framework */; + productType = "com.apple.product-type.framework"; + }; + DD491219134342C5B2A77666B9693F7D /* SipHash-macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 3A4BE593D32211A7D2A42A389E3A7B23 /* Build configuration list for PBXNativeTarget "SipHash-macOS" */; + buildPhases = ( + 313408ABC47DD3A646A4873AD1CBDE6F /* Sources */, + 30F9549C764E0C109EEE77156AF8E0B3 /* Frameworks */, + 42C4CA3182BCE6E6C95263684A2C789D /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "SipHash-macOS"; + productName = "SipHash-macOS"; + productReference = 9B86D56D5519EA60B44C9EE6D7349D6B /* SipHash.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0930; + LastUpgradeCheck = 0940; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = 872444DDCE671286B85841E678F62BD1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 18681F9410FE7F351944C0BCDEDE5A03 /* BigInt-iOS */, + 4AD062C9E10892961D28F49164A57FF2 /* BigInt-macOS */, + D57632D02F765424F9D5C9B43BA02152 /* Pods-EllipticSwift */, + 2173037F0623FCA446AAB500E0159309 /* Pods-EllipticSwift_iOS */, + 6F500F9FD6FA8C6FB58CA54A9409B73D /* Pods-EllipticSwiftTests */, + 87621EF7E694514CE3C5A84316E7BC76 /* SipHash-iOS */, + DD491219134342C5B2A77666B9693F7D /* SipHash-macOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 09C360BE18772A72928E69C8C2DAE615 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 31526676FCCB2B5E1DDCC5ABA499AC8E /* Addition.swift in Sources */, + E3B8F2DEAFCBAD79848101800DB8906F /* BigInt-iOS-dummy.m in Sources */, + BCC50F1DA966FAC16C5C4F64AB5F059A /* BigInt.swift in Sources */, + A4953A8EF1C7A9B48AC839C730449C48 /* BigUInt.swift in Sources */, + 9978421AAF3623D2A587F6048B1FE903 /* Bitwise Ops.swift in Sources */, + 6FDA95F3C0F5C62FADB0CD58E2509BD0 /* Codable.swift in Sources */, + C171603843BEA1BAB8392C07D265C66E /* Comparable.swift in Sources */, + D645DE293EAC81959CD910A8EFE2AA08 /* Data Conversion.swift in Sources */, + EA0DD065A2B5191E67D65E3B635B3FF1 /* Division.swift in Sources */, + E0991D9483E574A6A574FD13D6240EDE /* Exponentiation.swift in Sources */, + D9D1A3F7B3875998708995F0353AB2C1 /* Floating Point Conversion.swift in Sources */, + 2A1A6CAE1C616A19C3B89A3AE7D90E22 /* GCD.swift in Sources */, + E1D7C0568FCB391E56FB216932F1E36B /* Hashable.swift in Sources */, + 752CD30647527A03F6582A544E751306 /* Integer Conversion.swift in Sources */, + 89653C42F6C9E0E261D23783398A65D7 /* Multiplication.swift in Sources */, + 91BD6023659AF83B66A198831CEF7262 /* Prime Test.swift in Sources */, + B9960BEA891F5B75DCFE543F47807252 /* Random.swift in Sources */, + 48B3F3097EF861D85D1486F49DA9FD36 /* Shifts.swift in Sources */, + C1BF8D5C4DEF1F0D44D2B57E35DD0E62 /* Square Root.swift in Sources */, + 6C2D74E3C39C4AA0D15A2C49D7C8E173 /* Strideable.swift in Sources */, + CC472CAE986FC27CE39CE95662308367 /* String Conversion.swift in Sources */, + 17C146FBB9860F0BBB5F5271DA77BBD4 /* Subtraction.swift in Sources */, + C96493E91E92A0DEB056C0104BDD141F /* Words and Bits.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1B9BC1FE8156B6B6DE8D2224B12FC956 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 322DAFDB7BD9962ACB1E7F4974E583A0 /* Addition.swift in Sources */, + CDDFA9A9D1B806191266A57559FDDF37 /* BigInt-macOS-dummy.m in Sources */, + 9151E76992667C619CC764715A288E7F /* BigInt.swift in Sources */, + 869799C2D795FC711AAB9809170E6AFF /* BigUInt.swift in Sources */, + 0F4E2CC59778C80F42C189530637E71F /* Bitwise Ops.swift in Sources */, + 423024E733CE7C936B5E4B83E9803CEA /* Codable.swift in Sources */, + FBD6148C545C4DE71E1D9CA5D05A2899 /* Comparable.swift in Sources */, + 2A1EAAB18FBC26D6BB01FD4913BCFA15 /* Data Conversion.swift in Sources */, + 0369FA27448903E074B7E8ECB10A83A1 /* Division.swift in Sources */, + BD3D1718F34D819DDC2A57DF0D0CB055 /* Exponentiation.swift in Sources */, + 702A3E5A15F8A631900194CB71C8A746 /* Floating Point Conversion.swift in Sources */, + 87139BF4BA9A392932684AC102DD12EC /* GCD.swift in Sources */, + 49B1F602A52B507C53156D8861E2DA25 /* Hashable.swift in Sources */, + 507FF4470A4E9DCCAFD15B0F11BCF630 /* Integer Conversion.swift in Sources */, + 4EC26F7ACB74A4043D5BE0E7F8713AB8 /* Multiplication.swift in Sources */, + BC8AA5FB3D42D48B23941955C3646474 /* Prime Test.swift in Sources */, + A3A80A4F14B4FD1E4022114D13B1AC41 /* Random.swift in Sources */, + 0ECF9660BC1912D246E73F6A3E29DDB8 /* Shifts.swift in Sources */, + 392C36808A67524C73275F47DB05E2BD /* Square Root.swift in Sources */, + 2C9F3497F191DFC3DF7FCD35012DF906 /* Strideable.swift in Sources */, + 29F912B450435F5617C4F54AAAFB46C1 /* String Conversion.swift in Sources */, + 5A5482D01FE415968FB61AC30DE05361 /* Subtraction.swift in Sources */, + B1A4E306F41DD07D0987FE455BA0E8F9 /* Words and Bits.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1BAB3F7ABE5E461C8DB9714564FE4AC1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 0F61E2E4E5BA37EB8911CA329516BB03 /* Pods-EllipticSwift_iOS-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 313408ABC47DD3A646A4873AD1CBDE6F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 405ADA5619543BC0A5F33A5802C716F4 /* Primitive Types.swift in Sources */, + E446C2424753254852D94D1A8144D11E /* RandomUInt64.swift in Sources */, + 9848884CE8CCF56B1F00B9D91B97A375 /* SipHash-macOS-dummy.m in Sources */, + AE872792BD3625DA810E4AABAFD757FF /* SipHashable.swift in Sources */, + 9EBB64510E7D3522F057841539A2F4C9 /* SipHasher.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 3692DFA65B757CE7A5C3D152360A3AB3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F0D0DF081D60457E9A728447E0F78393 /* Pods-EllipticSwiftTests-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 59FC05E62BA1CDE194A3A4595F39B348 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 926744BEBB0E01A291DE0E315100DDA3 /* Primitive Types.swift in Sources */, + 6C0158CC3AF0F71276FE68AD128A22B4 /* RandomUInt64.swift in Sources */, + 4C33211C072EF45B032C6C58E2F35ED2 /* SipHash-iOS-dummy.m in Sources */, + 65805ED1C440004E95440FACC67DDB07 /* SipHashable.swift in Sources */, + 89A748124AB30ED698B390EEEDA5FD95 /* SipHasher.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 74506231928FEB11E1D9F0D3B2780276 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7D0AAC5039821A12F6DE0E0F37F0F3AA /* Pods-EllipticSwift-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 73F18F9263C01CC77587FCE37641D0EA /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SipHash-macOS"; + target = DD491219134342C5B2A77666B9693F7D /* SipHash-macOS */; + targetProxy = BE81F54D6CB3335CA5C601C2C850D2FA /* PBXContainerItemProxy */; + }; + A303B202CB295329FE05D10292E940AB /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SipHash-iOS"; + target = 87621EF7E694514CE3C5A84316E7BC76 /* SipHash-iOS */; + targetProxy = 4757A4DB6ED4CC8BC44C4BDCEC77553A /* PBXContainerItemProxy */; + }; + B2A45EE11E6E3AF2BA2E2C35AB4CFEC4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "BigInt-macOS"; + target = 4AD062C9E10892961D28F49164A57FF2 /* BigInt-macOS */; + targetProxy = DF9BCE858761171B1CAF50663686275F /* PBXContainerItemProxy */; + }; + B7E4FAFA348987BEC887C9D200CF72AC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "BigInt-iOS"; + target = 18681F9410FE7F351944C0BCDEDE5A03 /* BigInt-iOS */; + targetProxy = C4B10BA4858C67D03557990C1A3B40B8 /* PBXContainerItemProxy */; + }; + D05934A6B79692F9FAF89D69D6524797 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SipHash-macOS"; + target = DD491219134342C5B2A77666B9693F7D /* SipHash-macOS */; + targetProxy = E0E322FB15E731F048AB7194AFD6B852 /* PBXContainerItemProxy */; + }; + DB13138D76F80A4A60C1CD0BB53B95D0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SipHash-iOS"; + target = 87621EF7E694514CE3C5A84316E7BC76 /* SipHash-iOS */; + targetProxy = BF60F997970F034433E67146377FC475 /* PBXContainerItemProxy */; + }; + E1ED36E611B3EA44D3CB19D163DF2173 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "Pods-EllipticSwift"; + target = D57632D02F765424F9D5C9B43BA02152 /* Pods-EllipticSwift */; + targetProxy = 4B34BE2C5699A9F01AD85D45CB4F5955 /* PBXContainerItemProxy */; + }; + ECCFDFF5FF9D29D8422726D36F2A10F2 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "BigInt-macOS"; + target = 4AD062C9E10892961D28F49164A57FF2 /* BigInt-macOS */; + targetProxy = C3FB8585C59E4BCD6B6E3C0C6473C5CC /* PBXContainerItemProxy */; + }; + EFF715EB07792D99C34897A5793D5DB7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "SipHash-macOS"; + target = DD491219134342C5B2A77666B9693F7D /* SipHash-macOS */; + targetProxy = 8178CC3D86490FB2D83A32F2AA6D295E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 00536A10FE7ECABC79E4449FF9657D44 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 14F3932A808B1A09D33BF18D08BA2322 /* SipHash-iOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SipHash-iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/SipHash-iOS/SipHash-iOS.modulemap"; + PRODUCT_MODULE_NAME = SipHash; + PRODUCT_NAME = SipHash; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 0129136E55A271826AF677166D901861 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 684B2C2F1B67B215F3B5C0AC34C417AB /* Pods-EllipticSwift_iOS.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwift_iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 1036764AAAD4BC6911CE24932C97157E /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 44FC539B6F61701DF1F937705468C950 /* BigInt-macOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_PREFIX_HEADER = "Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/BigInt-macOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/BigInt-macOS/BigInt-macOS.modulemap"; + PRODUCT_MODULE_NAME = BigInt; + PRODUCT_NAME = BigInt; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 12FC77EE7E6A0910384BB151E8CEF045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9BF7D0A3FB7223F35665BE2E1E2959B4 /* Pods-EllipticSwift.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwift/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 148FDA08247B2F69671BD7CF6B59085B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0501C374BC89DDB777CC7F4837939C23 /* BigInt-iOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/BigInt-iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/BigInt-iOS/BigInt-iOS.modulemap"; + PRODUCT_MODULE_NAME = BigInt; + PRODUCT_NAME = BigInt; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 25F0008F5531124C10ECCFD9264D19B0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_ALLOWED = NO; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + 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 = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + 4A36384B5914554AEA521E5ACB875A5D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = EF514ED2270473AD03F12AE3CD425518 /* Pods-EllipticSwiftTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwiftTests/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 6AD66ABEAAB6B7F8FEDF7FB7849A8B1B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 6D4DDAABFEF041160810F4D3995E5FAE /* Pods-EllipticSwiftTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwiftTests/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 8881FC05CE29D04389697C587DDAAEC0 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0501C374BC89DDB777CC7F4837939C23 /* BigInt-iOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/BigInt-iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/BigInt-iOS/BigInt-iOS.modulemap"; + PRODUCT_MODULE_NAME = BigInt; + PRODUCT_NAME = BigInt; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 89667DE48F3A532A94E91E335BA0B224 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2C4E46FE1A6611D26143521A1CFB5721 /* Pods-EllipticSwift_iOS.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwift_iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 9415A76F3237C4B6F9E982705835A073 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8427239576A918FDBCFA1D76F3FB5041 /* SipHash-macOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_PREFIX_HEADER = "Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SipHash-macOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/SipHash-macOS/SipHash-macOS.modulemap"; + PRODUCT_MODULE_NAME = SipHash; + PRODUCT_NAME = SipHash; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + A2181E26C2A625D0F9B7A8712957317A /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 14F3932A808B1A09D33BF18D08BA2322 /* SipHash-iOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_PREFIX_HEADER = "Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SipHash-iOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MODULEMAP_FILE = "Target Support Files/SipHash-iOS/SipHash-iOS.modulemap"; + PRODUCT_MODULE_NAME = SipHash; + PRODUCT_NAME = SipHash; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + A33F6A934248619FF99E0592AAEBCAA5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = BD51264FCF89B43A36C1999FA483DDB6 /* Pods-EllipticSwift.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = "Target Support Files/Pods-EllipticSwift/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MODULEMAP_FILE = "Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + B8C79F7215C7FB0106483AC860960AFA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 44FC539B6F61701DF1F937705468C950 /* BigInt-macOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_PREFIX_HEADER = "Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/BigInt-macOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/BigInt-macOS/BigInt-macOS.modulemap"; + PRODUCT_MODULE_NAME = BigInt; + PRODUCT_NAME = BigInt; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + C074312295FAB095BCF2BDE68D9496AA /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 8427239576A918FDBCFA1D76F3FB5041 /* SipHash-macOS.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + GCC_PREFIX_HEADER = "Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/SipHash-macOS/Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "Target Support Files/SipHash-macOS/SipHash-macOS.modulemap"; + PRODUCT_MODULE_NAME = SipHash; + PRODUCT_NAME = SipHash; + SDKROOT = macosx; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 4.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + D3C4E6072233121DCF90EC871288C3FA /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_ALLOWED = NO; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + 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 = 9.0; + MACOSX_DEPLOYMENT_TARGET = 10.11; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + STRIP_INSTALLED_PRODUCT = NO; + SWIFT_COMPILATION_MODE = wholemodule; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2BB211B05B81AB0549FFBE1B732A7FE3 /* Build configuration list for PBXNativeTarget "Pods-EllipticSwiftTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4A36384B5914554AEA521E5ACB875A5D /* Debug */, + 6AD66ABEAAB6B7F8FEDF7FB7849A8B1B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 25F0008F5531124C10ECCFD9264D19B0 /* Debug */, + D3C4E6072233121DCF90EC871288C3FA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 3A4BE593D32211A7D2A42A389E3A7B23 /* Build configuration list for PBXNativeTarget "SipHash-macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9415A76F3237C4B6F9E982705835A073 /* Debug */, + C074312295FAB095BCF2BDE68D9496AA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 41D2DD9C4BEE98C4B0C26DB90D5C471E /* Build configuration list for PBXNativeTarget "Pods-EllipticSwift_iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 0129136E55A271826AF677166D901861 /* Debug */, + 89667DE48F3A532A94E91E335BA0B224 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 5B77C358650A251FAEEFEEF799D7F6BB /* Build configuration list for PBXNativeTarget "SipHash-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A2181E26C2A625D0F9B7A8712957317A /* Debug */, + 00536A10FE7ECABC79E4449FF9657D44 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9FEEFB21924E0328DC9615BC9FA29153 /* Build configuration list for PBXNativeTarget "Pods-EllipticSwift" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A33F6A934248619FF99E0592AAEBCAA5 /* Debug */, + 12FC77EE7E6A0910384BB151E8CEF045 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BF30E2F3AFCBFA2BD83765273E94FE80 /* Build configuration list for PBXNativeTarget "BigInt-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 148FDA08247B2F69671BD7CF6B59085B /* Debug */, + 8881FC05CE29D04389697C587DDAAEC0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C1BCB594B353DDB57B472C32761BCF0D /* Build configuration list for PBXNativeTarget "BigInt-macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1036764AAAD4BC6911CE24932C97157E /* Debug */, + B8C79F7215C7FB0106483AC860960AFA /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/Pods/SipHash/LICENSE.md b/Pods/SipHash/LICENSE.md new file mode 100644 index 0000000..0759583 --- /dev/null +++ b/Pods/SipHash/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. diff --git a/Pods/SipHash/README.md b/Pods/SipHash/README.md new file mode 100644 index 0000000..49fe93e --- /dev/null +++ b/Pods/SipHash/README.md @@ -0,0 +1,161 @@ +# SipHash + +[![Swift 4.0](https://img.shields.io/badge/Swift-4-blue.svg)](https://swift.org) +[![License](https://img.shields.io/badge/licence-MIT-blue.svg)](https://github.com/attaswift/SipHash/blob/master/LICENSE.md) +[![Platform](https://img.shields.io/badge/platforms-macOS%20∙%20iOS%20∙%20watchOS%20∙%20tvOS%20∙%20Linux-blue.svg)](https://developer.apple.com/platforms/) + +[![Build Status](https://travis-ci.org/attaswift/SipHash.svg?branch=master)](https://travis-ci.org/attaswift/SipHash) +[![Code Coverage](https://codecov.io/github/attaswift/SipHash/coverage.svg?branch=master)](https://codecov.io/github/attaswift/SipHash?branch=master) + +[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage) +[![CocoaPod Version](https://img.shields.io/cocoapods/v/SipHash.svg)](http://cocoapods.org/pods/SipHash) + +`SipHash` is a pure Swift implementation of the [SipHash] hashing algorithm designed by +Jean-Philippe Aumasson and Daniel J. Bernstein in 2012: + +[SipHash]: https://131002.net/siphash + +> SipHash is a family of pseudorandom functions (a.k.a. keyed hash functions) optimized for speed on short messages. +> +> Target applications include network traffic authentication and defense against hash-flooding DoS attacks. +> +> SipHash is secure, fast, and simple (for real): +> - SipHash is simpler and faster than previous cryptographic algorithms (e.g. MACs based on universal hashing) +> - SipHash is competitive in performance with insecure non-cryptographic algorithms (e.g. MurmurHash) +> +> -- [131002.net][SipHash] + +SipHash has a variety of flavors; this package implements the one called SipHash-2-4. + +Note that the Swift Standard Library [already includes an implementation][stdlib] of SipHash-2-4 and SipHash-1-3; +however, the APIs are currently private and not available for use outside of stdlib. This package provides an +independent implementation that's available for use in third-party code. + +[stdlib]: https://github.com/apple/swift/blob/master/stdlib/public/core/SipHash.swift.gyb + +The current release of SipHash requires Swift 4. + +## Sample Code + +```swift +import SipHash + +// `SipHashable` is like `Hashable`, but simpler. +struct Book: SipHashable { + let title: String + let pageCount: Int + + // You need to implement this method instead of `hashValue`. + func appendHashes(to hasher: inout SipHasher) { + // Simply append the fields you want to include in the hash. + hasher.append(title) + hasher.append(pageCount) + } + + static func ==(left: Book, right: Book) -> Bool { + return left.title == right.title && left.pageCount == right.pageCount + } +} + +// You can now use Books in sets or as dictionary keys. +let book = Book(title: "The Colour of Magic", pageCount: 206) +let books: Set = [book] + + +// If you prefer to do so, you may also create & use hashers directly. +var hasher = SipHasher() +hasher.add(book) +hasher.add(42) +// Finalizing the hasher extracts the hash value and invalidates it. +let hash = hasher.finalize() +``` + +## Why Would I Use SipHash? + +Writing a good implementation of `hashValue` is hard, even if we just need to combine the values of a couple of fields. +We need to come up with a deterministic function that blends the field values well, producing a fixed-width +result without too many collisions on typical inputs. But how many collisions are "too many"? Do we even know what +our "typical inputs" look like? For me, the answer to both of these questions is usually "I have absolutely no idea", +and I bet you have the same problem. + +Thus, verifying that our `hashValue` implementations work well is an exercise in frustration. + +We need to somehow check the properties of the hash function by looking at its behavior given various inputs. +It is easy enough to write tests for the requirement that equal values have equal `hashValues`. +But verifying that the hash has few collisions requires making some assumptions on the +statistical properties of "typical" inputs -- and even if we'd be somehow confident enough to do that, writing the code +to do it is way too complicated. + +Instead of rolling your own ad-hoc hash function, why not just use an algorithm designed specifically to blend data +into a hash? Using a standardized algorithm means we don't need to worry about collision behavior any more: if the +algorithm was designed well, we'll always have good results. + +The SipHash algorithm is a particularly good choice for hashing. It implements a 64-bit cryptographic +message-authentication code (MAC) with a 256-bit internal state initialized from a 128-bit secret key that's (typically) +randomly generated for each execution of the binary. +SipHash is designed to protect against hash collision attacks, while remaining simple to use and fast. +It is already used by Perl, Python, Ruby, Rust, and even Swift itself -- which is why the documentation of `Hashable` +explicitly warns that the value returned by `hashValue` may be different across executions. + +The standard library already implements SipHash, but the implementation is private. (It is technically available +for use, but it is not formally part of the stdlib API, and it is subject to change/removal across even point releases.) +I expect a refactored version of stdlib's SipHash will become available as public API in a future Swift release. +But while we're waiting for that, this package provides an alternative implementation that is available today. + +## Is this code full of bugs? + +Indubitably. Please report all bugs you find! + +The package has 100% unit test coverage. Unfortunately this doesn't tell you much about its reliability in practice. + +The test suite verifies that the package generates values that match the test vectors supplied by SipHash's original +authors, which makes me reasonably confident that this package implements SipHash correctly. +Obviously, your mileage may vary. + +## Reference docs + +[Nicely formatted reference docs][docs] are available courtesy of [Jazzy]. + +[docs]: https://attaswift.github.io/SipHash/ +[Jazzy]: https://github.com/realm/jazzy + +## Installation + +### CocoaPods + +If you use CocoaPods, you can start using `SipHash` by including it as a dependency in your `Podfile`: + +``` +pod 'SipHash', '~> 1.2' +``` + +### Carthage + +For Carthage, add the following line to your `Cartfile`: + +``` +github "attaswift/SipHash" ~> 1.2 +``` + +### Swift Package Manager + +For Swift Package Manager, add `SipHash` to the dependencies list inside your `Package.swift` file: + +``` +import PackageDescription + +let package = Package( + name: "MyPackage", + dependencies: [ + .Package(url: "https://github.com/attaswift/SipHash.git", from: "1.2.1") + ] +) +``` + +### Standalone Development + +If you don't use a dependency manager, you need to clone this repo somewhere near your project, and add a reference to `SipHash.xcodeproj` to your project's `xcworkspace`. You can put the clone of SipHash wherever you like on disk, but it is a good idea to set it up as a submodule of your app's top-level Git repository. + +To link your application binary with SipHash, just add `SipHash.framework` from the SipHash project to the Embedded Binaries section of your app target's General page in Xcode. As long as the SipHash project file is referenced in your workspace, this framework will be listed in the "Choose items to add" sheet that opens when you click on the "+" button of your target's Embedded Binaries list. + +There is no need to do any additional setup beyond adding the framework targets to Embedded Binaries. diff --git a/Pods/SipHash/SipHash/Primitive Types.swift b/Pods/SipHash/SipHash/Primitive Types.swift new file mode 100644 index 0000000..4582456 --- /dev/null +++ b/Pods/SipHash/SipHash/Primitive Types.swift @@ -0,0 +1,171 @@ +// +// Primitive Types.swift +// SipHash +// +// Created by Károly Lőrentey on 2016-11-14. +// Copyright © 2016-2017 Károly Lőrentey. +// + +extension SipHasher { + //MARK: Appending buffer slices + + /// Add the contents of `slice` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ slice: Slice) { + self.append(UnsafeRawBufferPointer(rebasing: slice)) + } + + //MARK: Appending Integers + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Bool) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Int) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: UInt) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Int64) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: UInt64) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Int32) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: UInt32) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Int16) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: UInt16) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Int8) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: UInt8) { + var data = value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } +} + +extension SipHasher { + //MARK: Appending Floating Point Types + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Float) { + var data = value.isZero ? 0.0 : value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Double) { + var data = value.isZero ? 0.0 : value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + + #if arch(i386) || arch(x86_64) + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Float80) { + var data = value.isZero ? 0.0 : value + // Float80 is 16 bytes wide but the last 6 are uninitialized. + let buffer = UnsafeRawBufferPointer(start: &data, count: 10) + append(buffer) + } + #endif +} + +#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) + import CoreGraphics + + extension SipHasher { + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: CGFloat) { + var data = value.isZero ? 0.0 : value + append(UnsafeRawBufferPointer(start: &data, count: MemoryLayout.size)) + } + } +#endif + +extension SipHasher { + //MARK: Appending Optionals + + /// Add `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: Value?) { + if let value = value { + self.append(1 as UInt8) + self.append(value) + } + else { + self.append(0 as UInt8) + } + } +} diff --git a/Pods/SipHash/SipHash/RandomUInt64.swift b/Pods/SipHash/SipHash/RandomUInt64.swift new file mode 100644 index 0000000..d55eb0b --- /dev/null +++ b/Pods/SipHash/SipHash/RandomUInt64.swift @@ -0,0 +1,39 @@ +// +// RandomUInt64.swift +// SipHash +// +// Created by Károly Lőrentey on 2016-11-14. +// Copyright © 2016-2017 Károly Lőrentey. +// + +#if os(iOS) || os(macOS) || os(watchOS) || os(tvOS) + import Darwin + + func randomUInt64() -> UInt64 { + return UInt64(arc4random()) << 32 | UInt64(arc4random()) + } +#elseif os(Linux) || os(FreeBSD) + import Glibc + + func randomUInt64() -> UInt64 { + var randomArray = [UInt8](repeating: 0, count: 8) + + let fd = open("/dev/urandom", O_RDONLY) + defer { + close(fd) + } + + let _ = read(fd, &randomArray, MemoryLayout.size * 8) + + var randomInt: UInt64 = 0 + for i in 0.. UInt64 { + fatalError("Unsupported platform") + } +#endif diff --git a/Pods/SipHash/SipHash/SipHashable.swift b/Pods/SipHash/SipHash/SipHashable.swift new file mode 100644 index 0000000..5811717 --- /dev/null +++ b/Pods/SipHash/SipHash/SipHashable.swift @@ -0,0 +1,65 @@ +// +// SipHashable.swift +// SipHash +// +// Created by Károly Lőrentey on 2016-11-14. +// Copyright © 2016-2017 Károly Lőrentey. +// + +/// A variant of `Hashable` that makes it simpler to generate good hash values. +/// +/// Instead of `hashValue`, you need to implement `addHashes`, adding +/// data that should contribute to the hash to the supplied hasher. +/// The hasher takes care of blending the supplied data together. +/// +/// Example implementation: +/// +/// ``` +/// struct Book: SipHashable { +/// var title: String +/// var pageCount: Int +/// +/// func appendHashes(to hasher: inout SipHasher) { +/// hasher.append(title) +/// hasher.append(pageCount) +/// } +/// +/// static func ==(left: Book, right: Book) -> Bool { +/// return left.title == right.title && left.pageCount == right.pageCount +/// } +/// } +/// ``` +public protocol SipHashable: Hashable { + /// Add components of `self` that should contribute to hashing to `hash`. + func appendHashes(to hasher: inout SipHasher) +} + +extension SipHashable { + /// The hash value, calculated using `addHashes`. + /// + /// Hash values are not guaranteed to be equal across different executions of your program. + /// Do not save hash values to use during a future execution. + public var hashValue: Int { + var hasher = SipHasher() + appendHashes(to: &hasher) + return hasher.finalize() + } +} + +extension SipHasher { + //MARK: Appending Hashable Values + + /// Add hashing components in `value` to this hash. This method simply calls `value.addHashes`. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: H) { + value.appendHashes(to: &self) + } + + /// Add the hash value of `value` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ value: H) { + append(value.hashValue) + } +} diff --git a/Pods/SipHash/SipHash/SipHasher.swift b/Pods/SipHash/SipHash/SipHasher.swift new file mode 100644 index 0000000..c1bfce6 --- /dev/null +++ b/Pods/SipHash/SipHash/SipHasher.swift @@ -0,0 +1,197 @@ +// +// SipHasher.swift +// SipHash +// +// Created by Károly Lőrentey on 2016-03-08. +// Copyright © 2016-2017 Károly Lőrentey. + +private func rotateLeft(_ value: UInt64, by amount: UInt64) -> UInt64 { + return (value << amount) | (value >> (64 - amount)) +} + +/// An implementation of the [SipHash-2-4](https://131002.net/siphash) hashing algorithm, +/// suitable for use in projects outside the Swift standard library. +/// (The Swift stdlib already includes SipHash; unfortunately its API is not public.) +/// +/// SipHash was invented by Jean-Philippe Aumasson and Daniel J. Bernstein. +public struct SipHasher { + /// The number of compression rounds. + private static let c = 2 + /// The number of finalization rounds. + private static let d = 4 + + /// The default key, used by the default initializer. + /// Each process has a unique key, chosen randomly when the first instance of `SipHasher` is initialized. + static let key: (UInt64, UInt64) = (randomUInt64(), randomUInt64()) + + /// Word 0 of the internal state, initialized to ASCII encoding of "somepseu". + var v0: UInt64 = 0x736f6d6570736575 + /// Word 1 of the internal state, initialized to ASCII encoding of "dorandom". + var v1: UInt64 = 0x646f72616e646f6d + /// Word 2 of the internal state, initialized to ASCII encoding of "lygenera". + var v2: UInt64 = 0x6c7967656e657261 + /// Word 3 of the internal state, initialized to ASCII encoding of "tedbytes". + var v3: UInt64 = 0x7465646279746573 + + /// The current partial word, not yet mixed in with the internal state. + var pendingBytes: UInt64 = 0 + /// The number of bytes that are currently pending in `tailBytes`. Guaranteed to be between 0 and 7. + var pendingByteCount = 0 + /// The number of bytes collected so far, or -1 if the hash value has already been finalized. + var byteCount = 0 + + //MARK: Initializers + + /// Initialize a new instance with the default key, generated randomly the first time this initializer is called. + public init() { + self.init(k0: SipHasher.key.0, k1: SipHasher.key.1) + } + + /// Initialize a new instance with the specified key. + /// + /// - Parameter k0: The low 64 bits of the secret key. + /// - Parameter k1: The high 64 bits of the secret key. + public init(k0: UInt64, k1: UInt64) { + v0 ^= k0 + v1 ^= k1 + v2 ^= k0 + v3 ^= k1 + } + + private mutating func sipRound() { + v0 = v0 &+ v1 + v1 = rotateLeft(v1, by: 13) + v1 ^= v0 + v0 = rotateLeft(v0, by: 32) + v2 = v2 &+ v3 + v3 = rotateLeft(v3, by: 16) + v3 ^= v2 + v0 = v0 &+ v3 + v3 = rotateLeft(v3, by: 21) + v3 ^= v0 + v2 = v2 &+ v1 + v1 = rotateLeft(v1, by: 17) + v1 ^= v2 + v2 = rotateLeft(v2, by: 32) + } + + mutating func compressWord(_ m: UInt64) { + v3 ^= m + for _ in 0 ..< SipHasher.c { + sipRound() + } + v0 ^= m + } + + mutating func _finalize() -> UInt64 { + precondition(byteCount >= 0) + pendingBytes |= UInt64(byteCount) << 56 + byteCount = -1 + + compressWord(pendingBytes) + + v2 ^= 0xff + for _ in 0 ..< SipHasher.d { + sipRound() + } + + return v0 ^ v1 ^ v2 ^ v3 + } + + //MARK: Appending data + + /// Add all bytes in `buffer` to this hash. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func append(_ buffer: UnsafeRawBufferPointer) { + precondition(byteCount >= 0) + + // Use the first couple of bytes to complete the pending word. + var i = 0 + if pendingByteCount > 0 { + let readCount = min(buffer.count, 8 - pendingByteCount) + var m: UInt64 = 0 + switch readCount { + case 7: + m |= UInt64(buffer[6]) << 48 + fallthrough + case 6: + m |= UInt64(buffer[5]) << 40 + fallthrough + case 5: + m |= UInt64(buffer[4]) << 32 + fallthrough + case 4: + m |= UInt64(buffer[3]) << 24 + fallthrough + case 3: + m |= UInt64(buffer[2]) << 16 + fallthrough + case 2: + m |= UInt64(buffer[1]) << 8 + fallthrough + case 1: + m |= UInt64(buffer[0]) + default: + precondition(readCount == 0) + } + pendingBytes |= m << UInt64(pendingByteCount << 3) + pendingByteCount += readCount + i += readCount + + if pendingByteCount == 8 { + compressWord(pendingBytes) + pendingBytes = 0 + pendingByteCount = 0 + } + } + + let left = (buffer.count - i) & 7 + let end = (buffer.count - i) - left + while i < end { + var m: UInt64 = 0 + withUnsafeMutableBytes(of: &m) { p in + p.copyMemory(from: .init(rebasing: buffer[i ..< i + 8])) + } + compressWord(UInt64(littleEndian: m)) + i += 8 + } + + switch left { + case 7: + pendingBytes |= UInt64(buffer[i + 6]) << 48 + fallthrough + case 6: + pendingBytes |= UInt64(buffer[i + 5]) << 40 + fallthrough + case 5: + pendingBytes |= UInt64(buffer[i + 4]) << 32 + fallthrough + case 4: + pendingBytes |= UInt64(buffer[i + 3]) << 24 + fallthrough + case 3: + pendingBytes |= UInt64(buffer[i + 2]) << 16 + fallthrough + case 2: + pendingBytes |= UInt64(buffer[i + 1]) << 8 + fallthrough + case 1: + pendingBytes |= UInt64(buffer[i]) + default: + precondition(left == 0) + } + pendingByteCount = left + + byteCount += buffer.count + } + + //MARK: Finalization + + /// Finalize this hash and return the hash value. + /// + /// - Requires: `finalize()` hasn't been called on this instance yet. + public mutating func finalize() -> Int { + return Int(truncatingIfNeeded: _finalize()) + } +} diff --git a/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-dummy.m b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-dummy.m new file mode 100644 index 0000000..f7d4233 --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_BigInt_iOS : NSObject +@end +@implementation PodsDummy_BigInt_iOS +@end diff --git a/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-umbrella.h b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-umbrella.h new file mode 100644 index 0000000..e3d2506 --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double BigIntVersionNumber; +FOUNDATION_EXPORT const unsigned char BigIntVersionString[]; + diff --git a/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.modulemap b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.modulemap new file mode 100644 index 0000000..2db919b --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.modulemap @@ -0,0 +1,6 @@ +framework module BigInt { + umbrella header "BigInt-iOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.xcconfig b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.xcconfig new file mode 100644 index 0000000..112e3a5 --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/BigInt-iOS.xcconfig @@ -0,0 +1,10 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/BigInt-iOS +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/BigInt +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/BigInt-iOS/Info.plist b/Pods/Target Support Files/BigInt-iOS/Info.plist new file mode 100644 index 0000000..90db36a --- /dev/null +++ b/Pods/Target Support Files/BigInt-iOS/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.1.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-dummy.m b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-dummy.m new file mode 100644 index 0000000..b6e84aa --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_BigInt_macOS : NSObject +@end +@implementation PodsDummy_BigInt_macOS +@end diff --git a/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch new file mode 100644 index 0000000..082f8af --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-umbrella.h b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-umbrella.h new file mode 100644 index 0000000..bde6666 --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double BigIntVersionNumber; +FOUNDATION_EXPORT const unsigned char BigIntVersionString[]; + diff --git a/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.modulemap b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.modulemap new file mode 100644 index 0000000..28927f2 --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.modulemap @@ -0,0 +1,6 @@ +framework module BigInt { + umbrella header "BigInt-macOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.xcconfig b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.xcconfig new file mode 100644 index 0000000..3b2088f --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/BigInt-macOS.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/BigInt +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/BigInt-macOS/Info.plist b/Pods/Target Support Files/BigInt-macOS/Info.plist new file mode 100644 index 0000000..90db36a --- /dev/null +++ b/Pods/Target Support Files/BigInt-macOS/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.1.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Info.plist b/Pods/Target Support Files/Pods-EllipticSwift/Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.markdown b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.markdown new file mode 100644 index 0000000..4a71c73 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.markdown @@ -0,0 +1,52 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## BigInt + + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + +## SipHash + +The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.plist b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.plist new file mode 100644 index 0000000..efa1cb4 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-acknowledgements.plist @@ -0,0 +1,90 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + License + MIT + Title + BigInt + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + + License + MIT + Title + SipHash + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-dummy.m b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-dummy.m new file mode 100644 index 0000000..0d027e3 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_EllipticSwift : NSObject +@end +@implementation PodsDummy_Pods_EllipticSwift +@end diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-resources.sh b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-resources.sh new file mode 100755 index 0000000..345301f --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-resources.sh @@ -0,0 +1,118 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +case "${TARGETED_DEVICE_FAMILY:-}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + 3) + TARGET_DEVICE_ARGS="--target-device tv" + ;; + 4) + TARGET_DEVICE_ARGS="--target-device watch" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" || true + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "${PODS_ROOT}*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi +fi diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-umbrella.h b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-umbrella.h new file mode 100644 index 0000000..9965524 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_EllipticSwiftVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_EllipticSwiftVersionString[]; + diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.debug.xcconfig b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.debug.xcconfig new file mode 100644 index 0000000..99942f5 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.debug.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap new file mode 100644 index 0000000..4d9d9b5 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.modulemap @@ -0,0 +1,6 @@ +framework module Pods_EllipticSwift { + umbrella header "Pods-EllipticSwift-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.release.xcconfig b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.release.xcconfig new file mode 100644 index 0000000..99942f5 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift/Pods-EllipticSwift.release.xcconfig @@ -0,0 +1,11 @@ +CODE_SIGN_IDENTITY = +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Info.plist b/Pods/Target Support Files/Pods-EllipticSwiftTests/Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.markdown b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.markdown new file mode 100644 index 0000000..4a71c73 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.markdown @@ -0,0 +1,52 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## BigInt + + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + +## SipHash + +The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.plist b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.plist new file mode 100644 index 0000000..efa1cb4 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-acknowledgements.plist @@ -0,0 +1,90 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + License + MIT + Title + BigInt + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + + License + MIT + Title + SipHash + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-dummy.m b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-dummy.m new file mode 100644 index 0000000..9b242d7 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_EllipticSwiftTests : NSObject +@end +@implementation PodsDummy_Pods_EllipticSwiftTests +@end diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh new file mode 100755 index 0000000..fff7812 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-frameworks.sh @@ -0,0 +1,155 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then + # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy + # frameworks to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" + +# Used as a return value for each invocation of `strip_invalid_archs` function. +STRIP_BINARY_RETVAL=0 + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +# Copies and strips a vendored framework +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + # Use filter instead of exclude so missing patterns don't throw errors. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} + +# Copies and strips a vendored dSYM +install_dsym() { + local source="$1" + if [ -r "$source" ]; then + # Copy the dSYM into a the targets temp dir. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" + + local basename + basename="$(basename -s .framework.dSYM "$source")" + binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then + strip_invalid_archs "$binary" + fi + + if [[ $STRIP_BINARY_RETVAL == 1 ]]; then + # Move the stripped file into its final destination. + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" + else + # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. + touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" + fi + fi +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" + + if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + code_sign_cmd="$code_sign_cmd &" + fi + echo "$code_sign_cmd" + eval "$code_sign_cmd" + fi +} + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + # Get architectures for current target binary + binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" + # Intersect them with the architectures we are building for + intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" + # If there are no archs supported by this binary then warn the user + if [[ -z "$intersected_archs" ]]; then + echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." + STRIP_BINARY_RETVAL=0 + return + fi + stripped="" + for arch in $binary_archs; do + if ! [[ "${ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi + STRIP_BINARY_RETVAL=1 +} + + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/BigInt-macOS/BigInt.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SipHash-macOS/SipHash.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${BUILT_PRODUCTS_DIR}/BigInt-macOS/BigInt.framework" + install_framework "${BUILT_PRODUCTS_DIR}/SipHash-macOS/SipHash.framework" +fi +if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + wait +fi diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-resources.sh b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-resources.sh new file mode 100755 index 0000000..345301f --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-resources.sh @@ -0,0 +1,118 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +case "${TARGETED_DEVICE_FAMILY:-}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + 3) + TARGET_DEVICE_ARGS="--target-device tv" + ;; + 4) + TARGET_DEVICE_ARGS="--target-device watch" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" || true + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "${PODS_ROOT}*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi +fi diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-umbrella.h b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-umbrella.h new file mode 100644 index 0000000..f4a4498 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_EllipticSwiftTestsVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_EllipticSwiftTestsVersionString[]; + diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.debug.xcconfig b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.debug.xcconfig new file mode 100644 index 0000000..f71030f --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.debug.xcconfig @@ -0,0 +1,12 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CODE_SIGN_IDENTITY = +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap new file mode 100644 index 0000000..76e7673 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.modulemap @@ -0,0 +1,6 @@ +framework module Pods_EllipticSwiftTests { + umbrella header "Pods-EllipticSwiftTests-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.release.xcconfig b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.release.xcconfig new file mode 100644 index 0000000..f71030f --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwiftTests/Pods-EllipticSwiftTests.release.xcconfig @@ -0,0 +1,12 @@ +ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES +CODE_SIGN_IDENTITY = +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-macOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Info.plist b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Info.plist new file mode 100644 index 0000000..2243fe6 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0.0 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.markdown b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.markdown new file mode 100644 index 0000000..4a71c73 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.markdown @@ -0,0 +1,52 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## BigInt + + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + +## SipHash + +The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + +Generated by CocoaPods - https://cocoapods.org diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.plist b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.plist new file mode 100644 index 0000000..efa1cb4 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-acknowledgements.plist @@ -0,0 +1,90 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + +Copyright (c) 2016-2017 Károly Lőrentey + +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. + + License + MIT + Title + BigInt + Type + PSGroupSpecifier + + + FooterText + The MIT License (MIT) + +Copyright (c) 2016 Károly Lőrentey + +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. + + License + MIT + Title + SipHash + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-dummy.m b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-dummy.m new file mode 100644 index 0000000..6bf1eca --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_EllipticSwift_iOS : NSObject +@end +@implementation PodsDummy_Pods_EllipticSwift_iOS +@end diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-resources.sh b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-resources.sh new file mode 100755 index 0000000..345301f --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-resources.sh @@ -0,0 +1,118 @@ +#!/bin/sh +set -e +set -u +set -o pipefail + +if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then + # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy + # resources to, so exit 0 (signalling the script phase was successful). + exit 0 +fi + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +# This protects against multiple targets copying the same framework dependency at the same time. The solution +# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html +RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") + +case "${TARGETED_DEVICE_FAMILY:-}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + 3) + TARGET_DEVICE_ARGS="--target-device tv" + ;; + 4) + TARGET_DEVICE_ARGS="--target-device watch" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true + rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" || true + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "${PODS_ROOT}*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + else + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" + fi +fi diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-umbrella.h b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-umbrella.h new file mode 100644 index 0000000..fbb1deb --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double Pods_EllipticSwift_iOSVersionNumber; +FOUNDATION_EXPORT const unsigned char Pods_EllipticSwift_iOSVersionString[]; + diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.debug.xcconfig b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.debug.xcconfig new file mode 100644 index 0000000..cea3306 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.debug.xcconfig @@ -0,0 +1,10 @@ +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-iOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap new file mode 100644 index 0000000..d95557c --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.modulemap @@ -0,0 +1,6 @@ +framework module Pods_EllipticSwift_iOS { + umbrella header "Pods-EllipticSwift_iOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.release.xcconfig b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.release.xcconfig new file mode 100644 index 0000000..cea3306 --- /dev/null +++ b/Pods/Target Support Files/Pods-EllipticSwift_iOS/Pods-EllipticSwift_iOS.release.xcconfig @@ -0,0 +1,10 @@ +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-iOS" "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' '@executable_path/../../Frameworks' +OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/BigInt-iOS/BigInt.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS/SipHash.framework/Headers" +OTHER_LDFLAGS = $(inherited) -framework "BigInt" -framework "SipHash" +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/Pods/Target Support Files/SipHash-iOS/Info.plist b/Pods/Target Support Files/SipHash-iOS/Info.plist new file mode 100644 index 0000000..e433362 --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.2.2 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-dummy.m b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-dummy.m new file mode 100644 index 0000000..41ad39f --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SipHash_iOS : NSObject +@end +@implementation PodsDummy_SipHash_iOS +@end diff --git a/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-umbrella.h b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-umbrella.h new file mode 100644 index 0000000..65aec28 --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double SipHashVersionNumber; +FOUNDATION_EXPORT const unsigned char SipHashVersionString[]; + diff --git a/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.modulemap b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.modulemap new file mode 100644 index 0000000..74a5852 --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.modulemap @@ -0,0 +1,6 @@ +framework module SipHash { + umbrella header "SipHash-iOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.xcconfig b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.xcconfig new file mode 100644 index 0000000..e561e8d --- /dev/null +++ b/Pods/Target Support Files/SipHash-iOS/SipHash-iOS.xcconfig @@ -0,0 +1,9 @@ +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SipHash-iOS +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SipHash +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/Pods/Target Support Files/SipHash-macOS/Info.plist b/Pods/Target Support Files/SipHash-macOS/Info.plist new file mode 100644 index 0000000..e433362 --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ${PRODUCT_BUNDLE_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.2.2 + CFBundleSignature + ???? + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + NSPrincipalClass + + + diff --git a/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-dummy.m b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-dummy.m new file mode 100644 index 0000000..cbefaa9 --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_SipHash_macOS : NSObject +@end +@implementation PodsDummy_SipHash_macOS +@end diff --git a/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch new file mode 100644 index 0000000..082f8af --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-umbrella.h b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-umbrella.h new file mode 100644 index 0000000..ae5b2f0 --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS-umbrella.h @@ -0,0 +1,16 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + + +FOUNDATION_EXPORT double SipHashVersionNumber; +FOUNDATION_EXPORT const unsigned char SipHashVersionString[]; + diff --git a/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.modulemap b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.modulemap new file mode 100644 index 0000000..bade1c5 --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.modulemap @@ -0,0 +1,6 @@ +framework module SipHash { + umbrella header "SipHash-macOS-umbrella.h" + + export * + module * { export * } +} diff --git a/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.xcconfig b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.xcconfig new file mode 100644 index 0000000..1d9095b --- /dev/null +++ b/Pods/Target Support Files/SipHash-macOS/SipHash-macOS.xcconfig @@ -0,0 +1,10 @@ +CODE_SIGN_IDENTITY = +CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SipHash-macOS +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" +PODS_BUILD_DIR = ${BUILD_DIR} +PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/SipHash +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/README.md b/README.md new file mode 100644 index 0000000..485a825 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# EllipticSwift