diff --git a/Base58Swift/Base58.swift b/Base58Swift/Base58.swift index 6139dff..42b0bde 100644 --- a/Base58Swift/Base58.swift +++ b/Base58Swift/Base58.swift @@ -1,8 +1,8 @@ // Copyright Keefer Taylor, 2019. -import BigInt -import CommonCrypto +@preconcurrency import BigInt import Foundation +import Crypto /// A static utility class which provides Base58 encoding and decoding functionality. public enum Base58 { @@ -96,12 +96,6 @@ public enum Base58 { /// - Parameter data: Input data to hash. /// - Returns: A sha256 hash of the input data. private static func sha256(_ data: [UInt8]) -> [UInt8] { - let res = NSMutableData(length: Int(CC_SHA256_DIGEST_LENGTH))! - CC_SHA256( - (Data(data) as NSData).bytes, - CC_LONG(data.count), - res.mutableBytes.assumingMemoryBound(to: UInt8.self) - ) - return [UInt8](res as Data) + Array(SHA256.hash(data: Data(data))) } } diff --git a/Package.resolved b/Package.resolved index 6e8e5ed..602d54a 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,25 +1,24 @@ { - "object": { - "pins": [ - { - "package": "BigInt", - "repositoryURL": "https://github.com/attaswift/BigInt.git", - "state": { - "branch": null, - "revision": "018a5925f60f9e0523edd261de394a0898fe95b7", - "version": "3.1.0" - } - }, - { - "package": "SipHash", - "repositoryURL": "https://github.com/attaswift/SipHash", - "state": { - "branch": null, - "revision": "e325083424688055363bbfcb7f1a440d7d7a1bae", - "version": "1.2.2" - } + "originHash" : "0f727c2b567d2f9854922a6efcc01d964a34c3f005a4ec264cc20c4cc675a0f6", + "pins" : [ + { + "identity" : "bigint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/attaswift/BigInt.git", + "state" : { + "revision" : "a7ee11486233ba45f5ceee0b8cb3d6629ed450ef", + "version" : "5.5.0" } - ] - }, - "version": 1 + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto.git", + "state" : { + "revision" : "cc76b894169a3c86b71bac10c78a4db6beb7a9ad", + "version" : "3.2.0" + } + } + ], + "version" : 3 } diff --git a/Package.swift b/Package.swift index 3370474..4a418f5 100644 --- a/Package.swift +++ b/Package.swift @@ -1,20 +1,28 @@ -// swift-tools-version:5.0 +// swift-tools-version:6.0 import PackageDescription let package = Package( name: "Base58Swift", + platforms: [ + .macOS(.v10_15), + .iOS(.v13), + ], products: [ .library( name: "Base58Swift", targets: ["Base58Swift"]) ], dependencies: [ - .package(url: "https://github.com/attaswift/BigInt.git", from: "5.0.0") + .package(url: "https://github.com/attaswift/BigInt.git", from: "5.0.0"), + .package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"), ], targets: [ .target( name: "Base58Swift", - dependencies: ["BigInt"], + dependencies: [ + "BigInt", + .product(name: "Crypto", package: "swift-crypto") + ], path: "Base58Swift"), .testTarget( name: "base58swiftTests",