Giter Site home page Giter Site logo

swiftmultihash's Introduction

SwiftMultihash

Carthage compatible

Swift implementation of multihash

Table of Contents

Install

Carthage

Add the following to your Cartfile:

github "multihash/SwiftMultihash"

Then, in the root of your project, type: carthage update --platform Mac

If you get the error 'Project "VarInt.xcodeproj" has no shared schemes'

Make sure your scheme is marked shared. For more details see here

  • from the Multihash root type carthage build
You will then need to add frameworks to your own Xcode project:
  • Select your target's Build Phases tab.

  • Select the Link Binary With Libraries, click the + and then Add 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

Requirements

  • Swift 3

Usage

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))
            }
        }
    }
}

Maintainers

Captain: @NeoTeo.

Contribute

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.

License

MIT © 2015 Matteo Sartori

swiftmultihash's People

Contributors

neoteo avatar richardlitt avatar

Watchers

 avatar

Forkers

thexdesk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.