diff --git a/.swiftpm/xcode/package.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/.swiftpm/xcode/package.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..54782e3 --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded + + + diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..1dbca2c --- /dev/null +++ b/Package.resolved @@ -0,0 +1,16 @@ +{ + "object": { + "pins": [ + { + "package": "CryptoSwift", + "repositoryURL": "https://github.com/krzyzanowskim/CryptoSwift.git", + "state": { + "branch": null, + "revision": "a44caef0550c346e0ab9172f7c9a3852c1833599", + "version": "1.3.0" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift index 892d1df..8ab9fcc 100644 --- a/Package.swift +++ b/Package.swift @@ -8,15 +8,16 @@ let package = Package( dependencies: [ // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), + .package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "1.0.0"), ], targets: [ // 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: "Blockchain", - dependencies: []), + dependencies: ["CryptoSwift"]), .testTarget( name: "BlockchainTests", - dependencies: ["Blockchain"]), + dependencies: ["Blockchain", "CryptoSwift"]), ] ) diff --git a/Sources/Blockchain/Models/Block.swift b/Sources/Blockchain/Models/Block.swift index cf3764d..ee97795 100644 --- a/Sources/Blockchain/Models/Block.swift +++ b/Sources/Blockchain/Models/Block.swift @@ -7,6 +7,7 @@ // import Foundation +import CryptoSwift class Block { var hash: String! @@ -15,6 +16,6 @@ class Block { var index: Int! func generateHash() -> String { - return NSUUID().uuidString.replacingOccurrences(of: "-", with: "") + return data.sha256() } }