semvec/pypi-packages huggingface dataset:
fnv-c 0.2.0
Python 3.7+ FNV (fnv0, fnv1, fnv1a) non-cryptographic hash library implemented in C through libffi

# fnv-c

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/botify-labs/fnv-c/lint.yaml)](https://github.com/botify-labs/fnv-c/actions/workflows/lint.yaml)
[![Codecov](https://img.shields.io/codecov/c/github/botify-labs/fnv-c)](https://app.codecov.io/github/botify-labs/fnv-c)
[![pypi badge](https://img.shields.io/pypi/v/fnv-c?color=brightgreen)](https://pypi.org/project/fnv-c/)

## What is it?

**fnv-c** is a Python 3.7+ FNV (`fnv0`, `fnv1`, `fnv1a`) **non-cryptographic** hash library implemented in C through libffi.

FNV ("Fowler–Noll–Vo") is is a non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Kiem-Phong.
FNV is probably no the "best" non-cryptographic hash function but:

- it has a reasonably good distribution
- it's very fast
- it's very easy to implement *(even in some exotic stored procedures for example)* so you can use it everywhere

More details on [this Wikepedia article](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function).

## Features

- speed: 
    - up to **800 MB/s** hashing speed *(on Macbook Pro M1 (2020) with `fnv0_64`)*
    - **6 800%** faster than basic Python implementation, **70%** faster than `pyhash` *(when hashing 100 bytes with `fnv0_64` on a cloud VM)*
- portability:
    - tested with recent Python versions (3.7+)
    - compatible with ARM64
    - compatible (and tested) with PyPy

## Non features

- other hash algorithms *(this library is only about FNV algorithm)*
- too agressive CPU optimizations *(we prefer maximizing binary portability)*

## Benchmark

You have a benchmark script [here](bench.py) to bench `fnv-c` by yourself and to compare it with:
- [`fnvhash`](https://github.com/znerol/py-fnvhash) (pure python implementation)
- [`pyhash`](https://github.com/flier/pyfasthash) (more general hashing library with C++ extension)

### Comparisons with other libraries (`fnv0_64` on a cloud VM)

Differences with `fnvhash` are huge (from **35%** for one byte hashing to **19 000%** for 1 000 bytes hashing with `fnv0_64`)

Differences with `pyhash` (on `fnv0_64`) are shown with the following diagram:

![](bench.png)

### Influence of string size on `fnv-c` hashing speed (on a Macbook Pro M1 (2020) with `fnv0_64`)

![](bench2.png)

## How to install/use it?

```
pip install fnv-c
```

```python
import fnv_c

print(fnv_c.fnv0_32(b"foo bar"))
print(fnv_c.fnv0_64(b"foo bar"))
print(fnv_c.fnv1_32(b"foo bar"))
print(fnv_c.fnv1_64(b"foo bar"))
print(fnv_c.fnv1a_32(b"foo bar"))
print(fnv_c.fnv1a_64(b"foo bar"))
```

## Function signatures / API

Full API doc is available at: [https://botify-labs.github.io/fnv-c/fnv_c/](https://botify-labs.github.io/fnv-c/fnv_c/)

## Dev

See [this specific document](DEV.md)
winfspy 0.8.4
CFFI bindings for WinFSP

===============================
WinFSPy
===============================

.. image:: https://github.com/scille/winfspy/actions/workflows/ci.yml/badge.svg
        :target: https://github.com/scille/winfspy/actions/workflows/ci.yml
        :alt: GitHub Actions Status

.. image:: https://codecov.io/gh/Scille/winfspy/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/Scille/winfspy

.. image:: https://img.shields.io/pypi/v/winfspy.svg
        :target: https://pypi.python.org/pypi/winfspy
        :alt: Pypi Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
        :target: https://github.com/ambv/black
        :alt: Code style: black

Bindings for `WinFSP <http://www.secfs.net/winfsp/>`_ version 1.4 and onward.

Winfspy consists of three important modules:

- ``winfspy``: expose the WinFSP API
- ``winfspy.memfs``: a memory file system based on winfspy
- ``winfspy.tests.winfsp_tests``: a test suite for black box testing
- ``winfspy.tests.winfstest``: a lighter test suite for black box testing


Requirements and installation
-----------------------------

`WinFSP <http://www.secfs.net/winfsp/>`_ version 1.4 or higher has to be installed separately.

Then install winfspy using pip::

    $ pip install winfspy


WinFSP python API
-----------------

Usage::

    from winfspy import (
        FileSystem,
        BaseFileSystemOperations,
        enable_debug_log,
        FILE_ATTRIBUTE,
        CREATE_FILE_CREATE_OPTIONS,
        NTStatusObjectNameNotFound,
        NTStatusDirectoryNotEmpty,
        NTStatusNotADirectory,
        NTStatusObjectNameCollision,
        NTStatusAccessDenied,
        NTStatusEndOfFile,
    )


Winfspy memory file system
---------------------------

Usage::

    # Run the memory fs as X: drive in verbose mode
    $ python -m winfspy.memfs X: -v

    # More information
    $ python -m winfspy.memfs


Winfsp-tests test suite
-----------------------

This test suite integrates the external test suite of
`winfsp-tests <https://github.com/billziss-gh/winfsp/tree/master/tst/winfsp-tests>`_.

Usage::

    # Install winfspy with the test dependencies
    $ pip install winfspy[test]

    # Run the winfstest test suite on an existing X: drive
    $ python winfspy.tests.winfsp_tests --file-system-path X:

    # More information about pytest
    $ python winfspy.tests.winfsp_tests -h


Winfstest test suite
--------------------

This test suite is taken from
`secfs.test.winfstest <https://bitbucket.org/billziss/secfs.test/>`_.
It is basic yet useful to test common use cases.

Usage::

    # Install winfspy with the test dependencies
    $ pip install winfspy[test]

    # Run the winfstest test suite on an existing X: drive
    $ python winfspy.tests.winfstest --file-system-path X:

    # More information about pytest
    $ python winfspy.tests.winfstest -h


License
-------

Free software: BSD