Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions Base58Swift/Base58.swift
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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)))
}
}
43 changes: 21 additions & 22 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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",
Expand Down