semvec/pypi-packages huggingface dataset:
lthash 0.1.0
A lightweight homomorphic, commutative hash implementation
Requires Python: >=3.6

# Homomorphic Commutative Hash (LtHash)

A lightweight homomorphic, commutative hash implementation in Python. Designed for set reconciliation and difference detection in distributed systems.

## Background

In a distributed system, database replication involves copying information to keep it synchronized across multiple locations to improve availability and read latency. This problem of securing update broadcasts in such systems was formally analyzed by Maitin-Shepard et al. in "Securing Update Propagation with Homomorphic Hashing" [ePrint 2019/227], which proposed the use of homomorphic hash functions for efficient verification. Database modifications must be propagated to each location to maintain the consistency of the replicated objects with the master database. For a model in which database writes are published by a central distributor that manages the master database, the distributor is responsible for propagating updates to a set of subscribers in a reliable and efficient manner. The simplest way to achieve this is for the distributor to be in charge of directly sending the updates to each subscribed client. In this repo I have attempted to implement the LtHash as specified by researchers at [Facebook](https://eprint.iacr.org/2019/227.pdf).

## Features

- Homomorphic: hash(a) + hash(b) = hash(a + b)
- Commutative: hash(a + b) = hash(b + a)
- Invertible: Elements can be added and removed
- Fixed size state (2048 bytes)
- Based on BLAKE2b and 16-bit arithmetic

## Usage

```python
from lthash import new16

# Basic usage
h = new16()
h.add(b"Hello")
h.add(b"World")
state = h.get_sum(b"")

# Remove elements
h.remove(b"World")

# Save/restore state
saved_state = h.get_sum(b"")
h2 = new16()
h2.set_state(saved_state)
```

## Use Cases

- Set reconciliation
- Difference detection
- Content-based deduplication
- Distributed caching

## Testing

```bash
python -m unittest tests/lthash_test.py
```
finish-sound 0.2.1
A simple package that plays a sound when code finishes running
Requires Python: >=3.6

# finish-sound

**Current Release**: 0.2.0

`finish-sound` is a simple, silly Python package that plays a sound when your code finishes executing. 
By defualt, it will be one of four random voices saying `"Your code is finished running!"`

## Demo
For your convenience, we have provided a Google Colab Notebook with which you can use to follow along:
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/kentjliu/finish-sound/blob/main/finish_sound_demo.ipynb)

## Installation

You can install the package via `pip`:
```
pip install finish-sound
```

## For Colab

Example usage

```
from finish_sound import play_finish_sound_notebook

...
// some long task (eg. training large diffusion model)

play_finish_sound_notebook()
```

### Custom Sounds
You can now create your custom sound to play when your code finishes running using our `CustomSound` class and `play_custom_sound` method (built on top of Google's `gtts` package).

```
from finish_sound import *

sound = CustomSound()
sound.text = 'This is my custom sound!`

// some long task (eg. scraping websites)

play_custom_sound(sound)
```

You can also set the local accent of the voice. By default, it is an Australian accent.

```
sound.accent = 'co.za' # South African accent
```

Refer to the table below for options.

| Local Accent                 | Param                                    |
|-------------------------|-------------------------------------------------|
| English (Australia)    | `com.au`          |
| English (United Kingdom)       | `co.uk` |
| English (United States)    | `us`       |
| English (Canada)  | `ca` |
| English (India)     | `co.in`             |
| English (Ireland)      | `ie`          |
| English (South Africa)     | `co.za`               |
| English (Nigeria)      | `com.ng`   |


## Local machine

Example usage

```
from finish_sound import play_finish_sound

...
// some long task (eg. loading llama model checkpoints)

play_finish_sound()
```

## Looking forward

* Plan to add more voices/sounds
* Tweak the sound: pitch, volume, etc.