semvec/pypi-packages huggingface dataset:
db-kirosake 1.6
DataBase with GitHub Repo
Requires Python: >=3.6

Description
===========

An easy-to-use cloud database that uses a GitHub repository to store
data. # Example Using an example, I will show you how to create a
database for a Discord server using pycord

.. code:: py

   import discord
   from discord.ext import commands,tasks
   import json
   from db_kirosake import dbkirosake
   from settings.config import *

   DB=dbkirosake.DBKirosake(
       actoken, # access token your GitHub account
       repos # your private/public repository
   )

   intents = discord.Intents.all()

   client = commands.Bot(
       command_prefix=prefix,
       intents=intents,
       bot=True
   )
   client.remove_command('help')

   @client.event
   async def on_ready():
       for guild in client.guilds:
           for member in guild.members:
               db={
                   'lvl':1,
                   'cash':10
               }
               await DB.create_db(
                   nameDB='test',
                   folder=guild.id,
                   ids=member.id,
                   database=db
               )
       
   client.run(token)

A database is created with the name ``nameDB`` which contains a folder
called ``guild.id`` and file ``users.json``

Structure ``../test/1234567890/users.json`` The users.json file contains
the list:

.. code:: json

   {
       "here ids": {
           "lvl": 1,
           "cash": 10
       }
   }

Data update
===========

.. code:: py

   DB=DBKirosake(
       actoken,
       repos
   )
   await DB.insert_one(
    	nameDB='test',
        folder="1234567890",
        ids="0987654321",
        insert='lvl',
        value=5,
        method='r' #r or a; replace or add
    )

Get dictionary
==============

.. code:: py

   dict=await DB.get(
        nameDB='test',
        folder="1234567890",
        ids="0987654321"
    )
    print(dict)
threshold-elgamal 0.0.13
Threshold ElGamal cryptosystem

# Threshold ElGamal cryptosystem

This is a library that provides methods for threshold encryption, decryption and DKG (distributed key generation) algorithm using the ElGamal cryptosystem. Threshold ElGamal encryption and decryption algorithms were based on Cachin's [work](https://cachin.com/cc/sft12/distcrypto.pdf), and the algorithm used for distributed key pair generation was based on a 1999 [paper](https://link.springer.com/chapter/10.1007/3-540-48910-X_21) by Gennaro et al. Both algorithms use a form of secret sharing first introduced in a 1979 [paper](https://dl.acm.org/doi/abs/10.1145/359168.359176) by Shamir. 

This goes without saying, but **you should NOT use this library in a production setting**. It has not been pentested nor was any kind of exhaustive security analysis done. This library is developed primarily for demonstration of theoretic threshold schemes.

## Installation

Before installing the library, make sure its dependencies are installed: `pycryptodome`, `gmpy2` and `setuptools`. The library is written for Python >= 3.9.

You can then install the library via `pip`:

```
pip install threshold-elgamal
```

## Getting started
The simplest way you can test out this library is by running its main function:

```python
from threshold_elgamal import run_tc_scheme

res = run_tc_scheme(k=3, n=5, m=10)
if res is True:
    print("Success!")
```

You can also create your own threshold scheme manually, and then encrypt and decrypt a message of your choosing:
```python
from threshold_elgamal import create_tc_scheme

message = 10
public_key, players, scheme = create_tc_scheme(k=3, n=5)
c1, c2 = scheme.encrypt(public_key, message=message)
decryption_shares = {player.id: player.get_decryption_share(c1) for player in players}
decrypted_msg = scheme.decrypt(c2, decryption_shares)

if decrypted_msg == message:
    print("Success!")
```