This project is no longer maintained and has been archived.
Swift implementation of multihash
Add the following to your Cartfile:
github "multihash/SwiftMultihash"
Then, in the root of your project, type:
carthage update --platform Mac
Make sure your scheme is marked shared. For more details see here
- from the Multihash root type
carthage build
-
Select your target's
Build Phases
tab. -
Select the
Link Binary With Libraries
, click the+
and thenAdd Other...
buttons. -
Navigate to the Carthage/Build/Mac directory in your project root and select the SwiftMultihash.framework, SwiftBase58.framework and SwiftHex.framework.
-
In case of a code signing error, select the target's Build Settings tab make sure the "Code Signing Identity" is either a valid identity or "Don't Code Sign".
For more information on how to install via Carthage see the README
- Swift 3
import SwiftMultihash
import SwiftHex
func test() {
if let buffer = SwiftHex.decodeString("0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33") {
let (multihashBuffer,_) = SwiftMultihash.encodeName(buffer, "sha1")
if let mhb = multihashBuffer {
var multihashHex = SwiftHex.encodeToString(mhb)
println("Hex: \(multihashHex)")
let (object, _) = SwiftMultihash.decode(mhb)
if let obj = object {
multihashHex = SwiftHex.encodeToString(obj.digest)
println(String(format: "obj: %@ 0x%X %d %@\n", obj.name!, obj.code, obj.length, multihashHex))
}
}
}
}
Captain: @NeoTeo.
Contributions are welcome! Check out the issues.
Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to Multiformats are subject to the IPFS Code of Conduct.
Small note: If editing the README, note that this README should be standard-readme compatible.
MIT © 2015 Matteo Sartori