Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Linux #26

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
@@ -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
}
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