semvec/pypi-packages huggingface dataset:
lamport-256 0.1
Simple single use Lamport signature scheme
Requires Python: >3.6

![codecov](https://codecov.io/gh/johnpaulkiser/lamport-256/branch/main/graph/badge.svg?token=ZWIK9EVZ3N)
![tests](https://github.com/johnpaulkiser/lamport-256/workflows/tests/badge.svg)
![upload to pypi](https://github.com/johnpaulkiser/lamport-256/workflows/upload%20to%20pypi/badge.svg)

# lamport-256
Simple single use Lamport signature scheme in python

_Great for building toy blockchains and the like._

**DO NOT use in a security conscious production environment!** 


## Usage:
### Library

To install run 
```bash
> pip install lamport-256
```

Import
```python
import lamport_256
```

Generate a private/public key pair
```python
key_pair = lamport_256.generate_keys()
private_key = key_pair.priv
public_key = key_pair.pub
```

> _from here on out the library functions will appear as if they were imported directly e.g. `from lamport_256 import sign_message`_

Sign a message
```python
signature = sign_message(private_key, 'Hello, World')
```

Verify a message
```python
if not verify_signature(public_key, 'Hello, World', signature):
    raise Exception('Invalid signature')
```

Dump keys to files
```python
# together
export_key_pair(key_pair, 'pub.key', 'priv.key') #filenames can be named anything you'd like

# or individually:
export_key(key_pair.priv, 'priv.key')
```

Read keys from file
```python
# together
key_pair = parse_key_pair('location/of/pub.key', 'location/of/priv.key')

# or individually:
pub = parse_key('pub.key')
```

_____
### CLI

Although you can simply run `python location/to/lamport_256.py generate_keys`, it's best to create an alias to run the python script.
```bash
# In your .bashrc or equivalent
alias lamp='python location/of/lamport_256.py'
```

Now you can run the script more concisely
```bash
lamp generate_keys
```

To specify where to save keys use the appropriate options
```bash
lamp generate_keys --priv location/to/save/key --pub location/to/save/key
```

Sign a message
```bash
lamp sign --priv location/of/private/key --msg 'Hello, world' > signature.txt

# or pass the message in as a file
lamp sign --priv location/of/private/key --msg location/of/message > signature.txt
```

Verify a signature
```bash
lamp verify --pub location/of/public/key --msg 'message' --sig location/of/signature 

# you can pass the message as a file here as well
lamp verify --pub location/of/public/key --msg location/of/message --sig location/of/signature 
```
formair 1.3.1
auto Forward eMails with custom Rules
Requires Python: >=3.6

# [ForMaiR](https://formair.io) - auto Forward eMails with custom Rules

<p>
  <a href="https://www.codefactor.io/repository/github/k8scat/formair"><img src="https://www.codefactor.io/repository/github/k8scat/formair/badge" alt="CodeFactor" /></a>
</p>

<p>
  <a href="https://github.com/k8scat/ForMaiR">GitHub</a> |
  <a href="https://gitee.com/k8scat/ForMaiR">码云</a>
</p>

## Quick start using Docker

Refer config: [template/config.yaml](https://github.com/k8scat/ForMaiR/blob/master/template/config.yaml)

```bash
docker run -d --rm \
-v /path/to/config.yaml:/formair/conf/config.yaml \
k8scat/formair:latest
```

## Installation

### Install using `pip`

```bash
python3 -m pip install --user formair
```

### Install using `git`

```bash
git clone git@github.com:k8scat/ForMaiR.git
cd ForMaiR
python3 setup.py install
```

## Usage

Refer config: [template/config.yaml](https://github.com/k8scat/ForMaiR/blob/master/template/config.yaml)

```bash
formair # load config from ./config.yaml

formair /path/to/config.yaml # load config from /path/to/config.yaml
```

## Custom rules

Emails which meet follow rules will be auto forwarded to `to_addrs`.

- [x] Email `from_addr[1]` in `from_addrs`
- [x] Email `subject` meet `subject_pattern`
- [x] Email `plain_content` or `html_content` meet `content_pattern`

```yaml
rules:
  -
    to_addrs:
      - 't1@example.com'
      - 't2@example.com'
    from_addrs:
      - 'f1@example.com'
      - 'f2@example.com'
    subject_pattern: ''
    content_pattern: ''
  -
    to_addrs:
      - 't1@example.com'
      - 't2@example.com'
    from_addrs:
      - 'f1@example.com'
      - 'f2@example.com'
    subject_pattern: ''
    content_pattern: ''
```

## Only forwarding the new emails

Support forwarding new emails in the specified range.

- Get `last_email_index` from the _index_file_ (default 0 if not exists)
- Get `email_count` from `pop3_server.stat`

```python
for index in range(last_email_index+1, email_count+1):
    pass
```

## Docs

[https://formair.io](https://formair.io)