GithubHelp home page GithubHelp logo

xxhash-swift's Introduction

xxHash-Swift

xxHash framework in Swift. Original xxHash algorithm created by Yann Collet.

Currently only suppport XXH3-64.

It currently points to the upstream v0.8.1

Requirements

  • Swift 5.0

Installation

Usage

import xxHash_Swift

Generate one-shot digest

let digest = XXH3.digest64("Input String")

let digest = XXH3.digest64(Data())

Generate digest by streaming

  1. non-async
let digest = try XXH3.digest64 { state in
    for data in dataProducer {
        try state.update(data)
    }
}
return String(digest, radix: 16, uppercase: true)
  1. async
let digest = try await XXH3.digest64 { state in
    for try await data in dataProducer {
        try state.update(data)
    }
}
return String(digest, radix: 16, uppercase: true)

Contribution

Update with upstream version

  1. Checkout upstream code with a new version, e.g. v0.8.2
git -C Sources/xxHash/xxHash checkout v0.8.2
  1. Update Sources and Tests if needed
  2. Update README if needed
  3. Tag with a new version accoring to Semantic Versioning 2.0.0

Update Swift Package Tools Version

  1. Update Package.swift manifest, according to Setting the Swift Tools Version

For example, if we want to set the tools version to 5.5

swift package tools-version --set 5.5
  1. Update README with Swift requirements
  2. Run test

Add more test according to upstream test data

Test data reference

Add more hash algorithm supported in the upstream

Reference file

License

The library is BSD licensed, which has the same as the upstream.

xxhash-swift's People

Contributors

sylvang avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

yujinqiu

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.