Code Monkey home page Code Monkey logo

seahash-py's Introduction

SeaHash

CI PyPI PyPI - Python Version PyPI - Wheel PyPI - Status PyPI - License

Python bindings to seahash - A blazingly fast, portable hash function with proven statistical guarantees.

Installation

pip install seahash

Wheels should be available for most platforms. If you need a wheel which isn't provided, raise an issue.

Compiling from source will require a Rust toolchain.

Usage

Hashing can be done in 2 ways:

Primitive functions

import seahash

# Plain hash
seahash.hash(b"123")

# Hash with custom seeds
seahash.hash_seeded(b"123", 4, 5, 6, 7)

Both methods return an int.

hashlib-compatible class

For convenience, a hashlib-compatible class is provided:

import seahash

s = seahash.SeaHash()

s.update(b"123")

s.digest()
s.hexdigest()

The underlying int digest can be obtained with intdigest.

seahash-py's People

Contributors

realorangeone avatar renovate[bot] avatar tlaferriere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tlaferriere

seahash-py's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
Cargo.toml
  • pyo3 0.20.3
  • seahash 4.1.0
  • pyo3-build-config 0.20.3
github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-python v5
  • actions/checkout v4
  • actions/setup-python v5
  • actions/checkout v4
  • pyo3/maturin-action v1
  • actions/checkout v4
  • actions/cache v4
  • actions-rs/toolchain v1
  • actions-rs/cargo v1
  • actions-rs/cargo v1
.github/workflows/release.yml
  • actions/checkout v4
  • messense/maturin-action v1
  • actions/upload-artifact v4
  • actions/checkout v4
  • actions/setup-python v5
  • messense/maturin-action v1
  • actions/upload-artifact v4
  • actions/checkout v4
  • messense/maturin-action v1
  • actions/upload-artifact v4
  • actions/checkout v4
  • messense/maturin-action v1
  • actions/upload-artifact v4
  • actions/download-artifact v4
  • messense/maturin-action v1
pep621
pyproject.toml
  • pytest ==8.0.2
  • ruff ==0.3.0
  • maturin >=1.5,<1.6

  • Check this box to trigger a request for Renovate to run again on this repository

`SeaHash` is not compatible with `hashlib.file_digest`

The following snippet:

    with open("file.txt", "rb") as f:
        s = hashlib.file_digest(f, lambda: seahash.SeaHash())

fails with the following error:

>           digestobj.update(view[:size])
E           TypeError: argument 'obj': 'memoryview' object cannot be converted to 'PyBytes'

C:\Python312\Lib\hashlib.py:236: TypeError

No wheel for my M1

using Python 3.11.1 (main, Dec 23 2022, 09:25:23) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin

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.