diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..7d09775a3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "Sources/libscrypt/libscrypt"] + path = Sources/libscrypt/libscrypt + url = https://github.com/technion/libscrypt.git diff --git a/Package.swift b/Package.swift index 2d2466274..351c0fcfa 100755 --- a/Package.swift +++ b/Package.swift @@ -23,9 +23,13 @@ let package = Package( // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target(name: "secp256k1"), + .target(name: "libscrypt", sources: ["libscrypt/crypto_scrypt-nosse.c", + "libscrypt/sha256.c", + "libscrypt/slowequals.c", + ]), .target( name: "web3swift", - dependencies: ["BigInt", "secp256k1", "PromiseKit", "Starscream", "CryptoSwift"], + dependencies: ["BigInt", "secp256k1", "PromiseKit", "Starscream", "CryptoSwift", "libscrypt"], exclude: [ ]), .testTarget( diff --git a/Sources/libscrypt/include/libscrypt.h b/Sources/libscrypt/include/libscrypt.h new file mode 100644 index 000000000..3c8ec2c15 --- /dev/null +++ b/Sources/libscrypt/include/libscrypt.h @@ -0,0 +1,2 @@ +#include "../libscrypt/libscrypt.h" + diff --git a/Sources/libscrypt/include/module.modulemap b/Sources/libscrypt/include/module.modulemap new file mode 100644 index 000000000..e9b1f79ef --- /dev/null +++ b/Sources/libscrypt/include/module.modulemap @@ -0,0 +1,4 @@ +module libscrypt [system] { + header "libscrypt.h" + export * +} \ No newline at end of file diff --git a/Sources/libscrypt/libscrypt b/Sources/libscrypt/libscrypt new file mode 160000 index 000000000..a402f4116 --- /dev/null +++ b/Sources/libscrypt/libscrypt @@ -0,0 +1 @@ +Subproject commit a402f4116245ce8677b3d9f4f87096b5ccbe26e9 diff --git a/Sources/web3swift/Convenience/CryptoExtensions.swift b/Sources/web3swift/Convenience/CryptoExtensions.swift index 737da519b..08ad82f05 100755 --- a/Sources/web3swift/Convenience/CryptoExtensions.swift +++ b/Sources/web3swift/Convenience/CryptoExtensions.swift @@ -5,7 +5,6 @@ // import Foundation -import CryptoSwift func toByteArray(_ value: T) -> [UInt8] { var value = value @@ -14,7 +13,6 @@ func toByteArray(_ value: T) -> [UInt8] { func scrypt (password: String, salt: Data, length: Int, N: Int, R: Int, P: Int) -> Data? { guard let passwordData = password.data(using: .utf8) else {return nil} - guard let deriver = try? Scrypt(password: passwordData.bytes, salt: salt.bytes, dkLen: length, N: N, r: R, p: P) else {return nil} - guard let result = try? deriver.calculate() else {return nil} + guard let result = try? Scrypt.calculate(password: passwordData.bytes, salt: salt.bytes, dkLen: length, N: N, r: R, p: P) else {return nil} return Data(result) } diff --git a/Sources/web3swift/KeystoreManager/BIP32Keystore.swift b/Sources/web3swift/KeystoreManager/BIP32Keystore.swift index 3e3a60da4..b18312841 100755 --- a/Sources/web3swift/KeystoreManager/BIP32Keystore.swift +++ b/Sources/web3swift/KeystoreManager/BIP32Keystore.swift @@ -303,14 +303,14 @@ public class BIP32Keystore: AbstractKeystore { guard let algo = keystorePars.crypto.kdfparams.prf else { return nil } - var hashVariant: HMAC.Variant?; + var hashVariant: PBKDF2.Variant?; switch algo { case "hmac-sha256": - hashVariant = HMAC.Variant.sha256 + hashVariant = .sha256 case "hmac-sha384": - hashVariant = HMAC.Variant.sha384 + hashVariant = .sha384 case "hmac-sha512": - hashVariant = HMAC.Variant.sha512 + hashVariant = .sha512 default: hashVariant = nil } @@ -323,7 +323,7 @@ public class BIP32Keystore: AbstractKeystore { guard let passData = password.data(using: .utf8) else { return nil } - guard let derivedArray = try? PKCS5.PBKDF2(password: passData.bytes, salt: saltData.bytes, iterations: c, keyLength: derivedLen, variant: hashVariant!).calculate() else { + guard let derivedArray = try? PBKDF2.calculate(password: passData.bytes, salt: saltData.bytes, iterations: c, keyLength: derivedLen, variant: hashVariant!) else { return nil } // passwordDerivedKey = Data(bytes:derivedArray) diff --git a/Sources/web3swift/KeystoreManager/BIP39.swift b/Sources/web3swift/KeystoreManager/BIP39.swift index fdf0bea5f..cdc00625e 100755 --- a/Sources/web3swift/KeystoreManager/BIP39.swift +++ b/Sources/web3swift/KeystoreManager/BIP39.swift @@ -150,7 +150,7 @@ public class BIP39 { guard let mnemData = mnemonics.decomposedStringWithCompatibilityMapping.data(using: .utf8) else {return nil} let salt = "mnemonic" + password guard let saltData = salt.decomposedStringWithCompatibilityMapping.data(using: .utf8) else {return nil} - guard let seedArray = try? PKCS5.PBKDF2(password: mnemData.bytes, salt: saltData.bytes, iterations: 2048, keyLength: 64, variant: HMAC.Variant.sha512).calculate() else {return nil} + guard let seedArray = try? PBKDF2.calculate(password: mnemData.bytes, salt: saltData.bytes, iterations: 2048, keyLength: 64, variant: .sha512) else {return nil} // let seed = Data(bytes:seedArray) let seed = Data(seedArray) return seed diff --git a/Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift b/Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift index 775268a74..0ff2cc63a 100755 --- a/Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift +++ b/Sources/web3swift/KeystoreManager/EthereumKeystoreV3.swift @@ -179,14 +179,14 @@ public class EthereumKeystoreV3: AbstractKeystore { guard let algo = keystoreParams.crypto.kdfparams.prf else { return nil } - var hashVariant: HMAC.Variant?; + var hashVariant: PBKDF2.Variant?; switch algo { case "hmac-sha256": - hashVariant = HMAC.Variant.sha256 + hashVariant = .sha256 case "hmac-sha384": - hashVariant = HMAC.Variant.sha384 + hashVariant = .sha384 case "hmac-sha512": - hashVariant = HMAC.Variant.sha512 + hashVariant = .sha512 default: hashVariant = nil } @@ -199,7 +199,7 @@ public class EthereumKeystoreV3: AbstractKeystore { guard let passData = password.data(using: .utf8) else { return nil } - guard let derivedArray = try? PKCS5.PBKDF2(password: passData.bytes, salt: saltData.bytes, iterations: c, keyLength: derivedLen, variant: hashVariant!).calculate() else { + guard let derivedArray = try? PBKDF2.calculate(password: passData.bytes, salt: saltData.bytes, iterations: c, keyLength: derivedLen, variant: hashVariant!) else { return nil } // passwordDerivedKey = Data(bytes:derivedArray) diff --git a/Sources/web3swift/Utils/Calculations/PBKDF2+Calculate.swift b/Sources/web3swift/Utils/Calculations/PBKDF2+Calculate.swift new file mode 100644 index 000000000..cde087ce7 --- /dev/null +++ b/Sources/web3swift/Utils/Calculations/PBKDF2+Calculate.swift @@ -0,0 +1,57 @@ +// +// PBKDF2+Calculate.swift +// web3swift +// +// Created by Pavel on 23.06.2021. +// + +import Foundation +import CommonCrypto + +enum PBKDF2 { + enum PBKDF2Error: Error { + case failed + } + + enum Variant: Int { + case sha1 + case sha256 + case sha384 + case sha512 + + var algorithm: Int { + switch self { + case .sha1: + return kCCPRFHmacAlgSHA1 + case .sha256: + return kCCPRFHmacAlgSHA256 + case .sha384: + return kCCPRFHmacAlgSHA384 + case .sha512: + return kCCPRFHmacAlgSHA512 + } + } + } + + static func calculate(password: Array, salt: Array, iterations: Int = 4096 /* c */, keyLength: Int? = nil /* dkLen */, variant: Variant = .sha256) throws -> Array { + + var derivedKey: Array = Array(repeating: 0, count: keyLength ?? 0) + + let passwordBytes = password.map { Int8($0) } + let derivationStatus = CCKeyDerivationPBKDF( + CCPBKDFAlgorithm(kCCPBKDF2), + passwordBytes, password.count, + salt, salt.count, + CCPseudoRandomAlgorithm(CCPBKDFAlgorithm(variant.algorithm)), + UInt32(iterations), + &derivedKey, + derivedKey.count) + + + if derivationStatus != 0 { + throw PBKDF2Error.failed + } + + return derivedKey + } +} diff --git a/Sources/web3swift/Utils/Calculations/Scrypt+Calculate.swift b/Sources/web3swift/Utils/Calculations/Scrypt+Calculate.swift new file mode 100644 index 000000000..15dc8aaf9 --- /dev/null +++ b/Sources/web3swift/Utils/Calculations/Scrypt+Calculate.swift @@ -0,0 +1,60 @@ +// +// Scrypt+Calculate.swift +// web3swift +// +// Created by Pavel on 23.06.2021. +// Copyright © 2021 Matter Labs. All rights reserved. +// + +import Foundation +import libscrypt + +enum Scrypt { + + enum ScryptError: Error { + case invalidLength + case invalidParameters + case emptySalt + case unknownError(code: Int32) + } + + static func calculate(password: Array, salt: Array, dkLen: Int, N: Int, r: Int, p: Int) throws -> [UInt8] { + + guard dkLen > 0, UInt64(dkLen) <= 137_438_953_440 else { + throw ScryptError.invalidLength + } + guard r > 0, p > 0, r * p < 1_073_741_824, N.isPowerOfTwo else { + throw ScryptError.invalidParameters + } + var rv = [UInt8](repeating: 0, count: dkLen) + var result: Int32 = -1 + try rv.withUnsafeMutableBufferPointer { bufptr in + try password.withUnsafeBufferPointer { passwd in + + try salt.withUnsafeBufferPointer { saltptr in + guard !saltptr.isEmpty else { + throw ScryptError.emptySalt + } + result = libscrypt_scrypt( + passwd.baseAddress!, passwd.count, + saltptr.baseAddress!, saltptr.count, + UInt64(N), UInt32(r), UInt32(p), + bufptr.baseAddress!, dkLen + ) + } + } + } + guard result == 0 else { + throw ScryptError.unknownError(code: result) + } + return rv + } +} + + +private extension BinaryInteger { + var isPowerOfTwo: Bool { + (self > 0) && (self & (self - 1) == 0) + } +} + diff --git a/web3swift.podspec b/web3swift.podspec index ab32c24d2..dfbae5251 100755 --- a/web3swift.podspec +++ b/web3swift.podspec @@ -18,4 +18,5 @@ Pod::Spec.new do |spec| spec.dependency 'CryptoSwift', '~> 1.4.0' spec.dependency 'secp256k1.c', '~> 0.1' spec.dependency 'PromiseKit', '~> 6.15.3' + spec.dependency 'libscrypt' end diff --git a/web3swift.xcodeproj/project.pbxproj b/web3swift.xcodeproj/project.pbxproj index af9bf888d..db67b8772 100755 --- a/web3swift.xcodeproj/project.pbxproj +++ b/web3swift.xcodeproj/project.pbxproj @@ -192,6 +192,30 @@ E2EDC5EA241EDE3600410EA6 /* BrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2EDC5E9241EDE3600410EA6 /* BrowserViewController.swift */; }; E2EDC5EC241EE18700410EA6 /* wk.bridge.min.js in Resources */ = {isa = PBXBuildFile; fileRef = E2EDC5EB241EE18700410EA6 /* wk.bridge.min.js */; }; E2EDC5EE241EE1E600410EA6 /* Bridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2EDC5ED241EE1E600410EA6 /* Bridge.swift */; }; + E97551C02683706A002794AF /* Scrypt+Calculate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E97551BE2683706A002794AF /* Scrypt+Calculate.swift */; }; + E97551C12683706A002794AF /* PBKDF2+Calculate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E97551BF2683706A002794AF /* PBKDF2+Calculate.swift */; }; + E9A21DC92683FC860062462C /* crypto_scrypt-hash.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DB42683FC860062462C /* crypto_scrypt-hash.c */; }; + E9A21DCA2683FC860062462C /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = E9A21DB52683FC860062462C /* LICENSE */; }; + E9A21DCB2683FC860062462C /* slowequals.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DB62683FC860062462C /* slowequals.c */; }; + E9A21DCC2683FC860062462C /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DB72683FC860062462C /* Makefile */; }; + E9A21DCD2683FC860062462C /* libscrypt.version in Resources */ = {isa = PBXBuildFile; fileRef = E9A21DB82683FC860062462C /* libscrypt.version */; }; + E9A21DCE2683FC860062462C /* b64.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DB92683FC860062462C /* b64.h */; }; + E9A21DCF2683FC860062462C /* sha256.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DBA2683FC860062462C /* sha256.h */; }; + E9A21DD02683FC860062462C /* crypto-scrypt-saltgen.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DBB2683FC860062462C /* crypto-scrypt-saltgen.c */; }; + E9A21DD12683FC860062462C /* crypto_scrypt-hexconvert.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DBC2683FC860062462C /* crypto_scrypt-hexconvert.c */; }; + E9A21DD22683FC860062462C /* crypto-mcf.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DBD2683FC860062462C /* crypto-mcf.c */; }; + E9A21DD32683FC860062462C /* sysendian.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DBE2683FC860062462C /* sysendian.h */; }; + E9A21DD42683FC860062462C /* libscrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DBF2683FC860062462C /* libscrypt.h */; }; + E9A21DD52683FC860062462C /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = E9A21DC02683FC860062462C /* README.md */; }; + E9A21DD62683FC860062462C /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DC12683FC860062462C /* main.c */; }; + E9A21DD72683FC860062462C /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = E9A21DC22683FC860062462C /* .gitignore */; }; + E9A21DD82683FC860062462C /* crypto_scrypt-check.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DC32683FC860062462C /* crypto_scrypt-check.c */; }; + E9A21DD92683FC860062462C /* slowequals.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DC42683FC860062462C /* slowequals.h */; }; + E9A21DDA2683FC860062462C /* b64.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DC52683FC860062462C /* b64.c */; }; + E9A21DDB2683FC860062462C /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DC62683FC860062462C /* sha256.c */; }; + E9A21DDC2683FC860062462C /* crypto_scrypt-nosse.c in Sources */ = {isa = PBXBuildFile; fileRef = E9A21DC72683FC860062462C /* crypto_scrypt-nosse.c */; }; + E9A21DDD2683FC860062462C /* crypto_scrypt-hexconvert.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DC82683FC860062462C /* crypto_scrypt-hexconvert.h */; }; + E9A21DDF2683FC9F0062462C /* libscrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = E9A21DDE2683FC9F0062462C /* libscrypt.h */; }; F5213FF42673849600EBDC50 /* CryptoSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5213FEF2673849600EBDC50 /* CryptoSwift.xcframework */; }; F5213FF52673849600EBDC50 /* CryptoSwift.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5213FEF2673849600EBDC50 /* CryptoSwift.xcframework */; }; F5213FF62673849600EBDC50 /* BigInt.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5213FF02673849600EBDC50 /* BigInt.xcframework */; }; @@ -406,6 +430,31 @@ E2EDC5E9241EDE3600410EA6 /* BrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserViewController.swift; sourceTree = ""; }; E2EDC5EB241EE18700410EA6 /* wk.bridge.min.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = wk.bridge.min.js; sourceTree = ""; }; E2EDC5ED241EE1E600410EA6 /* Bridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bridge.swift; sourceTree = ""; }; + E97551BE2683706A002794AF /* Scrypt+Calculate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Scrypt+Calculate.swift"; sourceTree = ""; }; + E97551BF2683706A002794AF /* PBKDF2+Calculate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PBKDF2+Calculate.swift"; sourceTree = ""; }; + E9A21DB42683FC860062462C /* crypto_scrypt-hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto_scrypt-hash.c"; sourceTree = ""; }; + E9A21DB52683FC860062462C /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; + E9A21DB62683FC860062462C /* slowequals.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = slowequals.c; sourceTree = ""; }; + E9A21DB72683FC860062462C /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + E9A21DB82683FC860062462C /* libscrypt.version */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = libscrypt.version; sourceTree = ""; }; + E9A21DB92683FC860062462C /* b64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = b64.h; sourceTree = ""; }; + E9A21DBA2683FC860062462C /* sha256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha256.h; sourceTree = ""; }; + E9A21DBB2683FC860062462C /* crypto-scrypt-saltgen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto-scrypt-saltgen.c"; sourceTree = ""; }; + E9A21DBC2683FC860062462C /* crypto_scrypt-hexconvert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto_scrypt-hexconvert.c"; sourceTree = ""; }; + E9A21DBD2683FC860062462C /* crypto-mcf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto-mcf.c"; sourceTree = ""; }; + E9A21DBE2683FC860062462C /* sysendian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sysendian.h; sourceTree = ""; }; + E9A21DBF2683FC860062462C /* libscrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libscrypt.h; sourceTree = ""; }; + E9A21DC02683FC860062462C /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + E9A21DC12683FC860062462C /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; + E9A21DC22683FC860062462C /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = ""; }; + E9A21DC32683FC860062462C /* crypto_scrypt-check.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto_scrypt-check.c"; sourceTree = ""; }; + E9A21DC42683FC860062462C /* slowequals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slowequals.h; sourceTree = ""; }; + E9A21DC52683FC860062462C /* b64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = b64.c; sourceTree = ""; }; + E9A21DC62683FC860062462C /* sha256.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha256.c; sourceTree = ""; }; + E9A21DC72683FC860062462C /* crypto_scrypt-nosse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "crypto_scrypt-nosse.c"; sourceTree = ""; }; + E9A21DC82683FC860062462C /* crypto_scrypt-hexconvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "crypto_scrypt-hexconvert.h"; sourceTree = ""; }; + E9A21DDE2683FC9F0062462C /* libscrypt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libscrypt.h; sourceTree = ""; }; + E9A21DE02683FCF40062462C /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; F5213FEF2673849600EBDC50 /* CryptoSwift.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CryptoSwift.xcframework; path = Carthage/Build/CryptoSwift.xcframework; sourceTree = ""; }; F5213FF02673849600EBDC50 /* BigInt.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = BigInt.xcframework; path = Carthage/Build/BigInt.xcframework; sourceTree = ""; }; F5213FF12673849600EBDC50 /* PromiseKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = PromiseKit.xcframework; path = Carthage/Build/PromiseKit.xcframework; sourceTree = ""; }; @@ -509,6 +558,7 @@ 1317BCFD218C526300D6D095 /* Sources */ = { isa = PBXGroup; children = ( + E9A21DB12683FC860062462C /* libscrypt */, 3AA815152276E3FF00F5DB52 /* web3swift */, 13C3385821B6C26900F33F5E /* secp256k1 */, ); @@ -631,6 +681,7 @@ 3AA815212276E44100F5DB52 /* Utils */ = { isa = PBXGroup; children = ( + E97551BD2683706A002794AF /* Calculations */, 3AA815222276E44100F5DB52 /* ENS */, 3AA8152B2276E44100F5DB52 /* Hooks */, 3AA8152D2276E44100F5DB52 /* EIP */, @@ -990,6 +1041,61 @@ path = Browser; sourceTree = ""; }; + E97551BD2683706A002794AF /* Calculations */ = { + isa = PBXGroup; + children = ( + E97551BE2683706A002794AF /* Scrypt+Calculate.swift */, + E97551BF2683706A002794AF /* PBKDF2+Calculate.swift */, + ); + path = Calculations; + sourceTree = ""; + }; + E9A21DB12683FC860062462C /* libscrypt */ = { + isa = PBXGroup; + children = ( + E9A21DB22683FC860062462C /* include */, + E9A21DB32683FC860062462C /* libscrypt */, + ); + path = libscrypt; + sourceTree = ""; + }; + E9A21DB22683FC860062462C /* include */ = { + isa = PBXGroup; + children = ( + E9A21DDE2683FC9F0062462C /* libscrypt.h */, + E9A21DE02683FCF40062462C /* module.modulemap */, + ); + path = include; + sourceTree = ""; + }; + E9A21DB32683FC860062462C /* libscrypt */ = { + isa = PBXGroup; + children = ( + E9A21DB42683FC860062462C /* crypto_scrypt-hash.c */, + E9A21DB52683FC860062462C /* LICENSE */, + E9A21DB62683FC860062462C /* slowequals.c */, + E9A21DB72683FC860062462C /* Makefile */, + E9A21DB82683FC860062462C /* libscrypt.version */, + E9A21DB92683FC860062462C /* b64.h */, + E9A21DBA2683FC860062462C /* sha256.h */, + E9A21DBB2683FC860062462C /* crypto-scrypt-saltgen.c */, + E9A21DBC2683FC860062462C /* crypto_scrypt-hexconvert.c */, + E9A21DBD2683FC860062462C /* crypto-mcf.c */, + E9A21DBE2683FC860062462C /* sysendian.h */, + E9A21DBF2683FC860062462C /* libscrypt.h */, + E9A21DC02683FC860062462C /* README.md */, + E9A21DC12683FC860062462C /* main.c */, + E9A21DC22683FC860062462C /* .gitignore */, + E9A21DC32683FC860062462C /* crypto_scrypt-check.c */, + E9A21DC42683FC860062462C /* slowequals.h */, + E9A21DC52683FC860062462C /* b64.c */, + E9A21DC62683FC860062462C /* sha256.c */, + E9A21DC72683FC860062462C /* crypto_scrypt-nosse.c */, + E9A21DC82683FC860062462C /* crypto_scrypt-hexconvert.h */, + ); + path = libscrypt; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -997,6 +1103,13 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + E9A21DCE2683FC860062462C /* b64.h in Headers */, + E9A21DD92683FC860062462C /* slowequals.h in Headers */, + E9A21DD42683FC860062462C /* libscrypt.h in Headers */, + E9A21DD32683FC860062462C /* sysendian.h in Headers */, + E9A21DDD2683FC860062462C /* crypto_scrypt-hexconvert.h in Headers */, + E9A21DDF2683FC9F0062462C /* libscrypt.h in Headers */, + E9A21DCF2683FC860062462C /* sha256.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1156,9 +1269,13 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + E9A21DD52683FC860062462C /* README.md in Resources */, + E9A21DD72683FC860062462C /* .gitignore in Resources */, E2B76710241ED479007EBFE3 /* browser.js in Resources */, E2EDC5EC241EE18700410EA6 /* wk.bridge.min.js in Resources */, + E9A21DCA2683FC860062462C /* LICENSE in Resources */, E22A911F241ED71A00EC1021 /* browser.min.js in Resources */, + E9A21DCD2683FC860062462C /* libscrypt.version in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1226,9 +1343,11 @@ 3A7EA35E2280EA9A005120C2 /* Encodable+Extensions.swift in Sources */, 3AA815D22276E44100F5DB52 /* Web3+JSONRPC.swift in Sources */, 3AA815F82276E44100F5DB52 /* Promise+Web3+Contract+GetIndexedEvents.swift in Sources */, + E9A21DC92683FC860062462C /* crypto_scrypt-hash.c in Sources */, 3AA815E42276E44100F5DB52 /* Data+Extension.swift in Sources */, 3AA815C62276E44100F5DB52 /* ABI.swift in Sources */, 3AA815D02276E44100F5DB52 /* Web3+Utils.swift in Sources */, + E97551C02683706A002794AF /* Scrypt+Calculate.swift in Sources */, 3AA815B82276E44100F5DB52 /* EthereumKeystoreV3.swift in Sources */, 3AA815EB2276E44100F5DB52 /* Promise+Web3+Personal+Sign.swift in Sources */, 3AA815E32276E44100F5DB52 /* Dictionary+Extension.swift in Sources */, @@ -1266,19 +1385,27 @@ 3AA815BD2276E44100F5DB52 /* BloomFilter.swift in Sources */, 3AA815F62276E44100F5DB52 /* Promise+Web3+Eth+SendRawTransaction.swift in Sources */, 3AA815FF2276E44100F5DB52 /* Web3+ERC721x.swift in Sources */, + E9A21DD02683FC860062462C /* crypto-scrypt-saltgen.c in Sources */, 3AA815E52276E44100F5DB52 /* NativeTypesEncoding+Extensions.swift in Sources */, 3AA815D12276E44100F5DB52 /* Web3+MutatingTransaction.swift in Sources */, 3AA815CA2276E44100F5DB52 /* Web3+HttpProvider.swift in Sources */, 3AA815D42276E44100F5DB52 /* Web3+Contract.swift in Sources */, 3AA815CE2276E44100F5DB52 /* Web3+Eventloop.swift in Sources */, + E9A21DDB2683FC860062462C /* sha256.c in Sources */, 3AA815B42276E44100F5DB52 /* BIP39.swift in Sources */, 3AA815E22276E44100F5DB52 /* NSRegularExpressionExtension.swift in Sources */, + E9A21DD82683FC860062462C /* crypto_scrypt-check.c in Sources */, + E9A21DD12683FC860062462C /* crypto_scrypt-hexconvert.c in Sources */, 3AA815C12276E44100F5DB52 /* Web3+BrowserFunctions.swift in Sources */, 3AA815E82276E44100F5DB52 /* Extensions.swift in Sources */, + E9A21DD22683FC860062462C /* crypto-mcf.c in Sources */, 3AA815FE2276E44100F5DB52 /* Web3+ERC820.swift in Sources */, 3AA815DB2276E44100F5DB52 /* Web3+TxPool.swift in Sources */, 3AA8160A2276E44100F5DB52 /* Web3+ERC1594.swift in Sources */, + E9A21DDA2683FC860062462C /* b64.c in Sources */, 3AA815FB2276E44100F5DB52 /* Promise+Web3+Personal+UnlockAccount.swift in Sources */, + E9A21DD62683FC860062462C /* main.c in Sources */, + E9A21DCB2683FC860062462C /* slowequals.c in Sources */, 3AA815AD2276E44100F5DB52 /* ENSRegistry.swift in Sources */, 3AA815CD2276E44100F5DB52 /* Web3+Personal.swift in Sources */, 3AA8151E2276E42F00F5DB52 /* EthereumFilterEncodingExtensions.swift in Sources */, @@ -1295,6 +1422,7 @@ 3AA815B62276E44100F5DB52 /* BIP39+WordLists.swift in Sources */, 3AA816032276E44100F5DB52 /* Web3+ERC20.swift in Sources */, E2EDC5EA241EDE3600410EA6 /* BrowserViewController.swift in Sources */, + E9A21DDC2683FC860062462C /* crypto_scrypt-nosse.c in Sources */, 3AA8160C2276E44100F5DB52 /* Web3+ERC1410.swift in Sources */, 3AA816042276E44100F5DB52 /* Web3+ERC1400.swift in Sources */, 3AA815ED2276E44100F5DB52 /* Promise+Web3+Eth+GetBlockByHash.swift in Sources */, @@ -1322,6 +1450,7 @@ 3AA815C42276E44100F5DB52 /* ABITypeParser.swift in Sources */, 3AA815BA2276E44100F5DB52 /* PlainKeystore.swift in Sources */, 3AA815C92276E44100F5DB52 /* RLP.swift in Sources */, + E9A21DCC2683FC860062462C /* Makefile in Sources */, 3AA816012276E44100F5DB52 /* Web3+ERC1376.swift in Sources */, 3AA815A72276E44100F5DB52 /* ENS.swift in Sources */, 3AA815F32276E44100F5DB52 /* Promise+Web3+Eth+GetTransactionReceipt.swift in Sources */, @@ -1332,6 +1461,7 @@ 3AA815E02276E44100F5DB52 /* CryptoExtensions.swift in Sources */, 3AA815D52276E44100F5DB52 /* Web3+EventParser.swift in Sources */, 3AA815C02276E44100F5DB52 /* Web3+Wallet.swift in Sources */, + E97551C12683706A002794AF /* PBKDF2+Calculate.swift in Sources */, 3AA815F12276E44100F5DB52 /* Promise+Web3+Eth+GetBalance.swift in Sources */, 3AA815D62276E44100F5DB52 /* Web3+ReadingTransaction.swift in Sources */, 3AA815AC2276E44100F5DB52 /* NameHash.swift in Sources */,