semvec/pypi-packages huggingface dataset:
randomart 0.2.3
Generate ASCII randomart by hashing input with BLAKE2b and using an adapted drunken bishop alogirthm.
License: MIT
Requires Python: >3.5
Keywords: randomart drunken bishop openssh blake2b blake2 hash comparison

# randomart.py

[![CodeFactor](https://www.codefactor.io/repository/github/ansemjo/randomart/badge)](https://www.codefactor.io/repository/github/ansemjo/randomart)

A script to present BLAKE2b hashes as small ASCII-art pictures, similarly to OpenSSH's
[randomart](https://superuser.com/q/22535).

This allows easier verification by humans but may not be as secure as a bytewise comparison of the
digest!

<span style="display:block;text-align:center">![](assets/randomart.png)</span>

See the paper [Hash Visualization: a New Technique to improve Real-World Security<sup>1</sup>][^1]
for more information on the concept of random art.

The paper [The drunken bishop: An analysis of the OpenSSH fingerprint visualization
algorithm<sup>2</sup>][^2] analyses the OpenSSH implementation in more detail.

It should be explicitly noted that my algorithm is _similar_ but not _identical_ to the "drunken
bishop" walk of the OpenSSH implementation. The implementation at hand:

- flips sides at the borders, which turns the field into a torus
- moves in all possible directions with distance 1, not only diagonally
- does not mark start (`S`) and end (`E`) and uses a different character palette

I have not performed any similar analysis[<sup>2</sup>][^2] but would expect my implementation to
perform no worse.

## installation

Install with pip directly from GitHub:

    pip install git+https://github.com/ansemjo/randomart

## usage

The script expects a file in the first positional argument or otherwise simply reads from standard
input. It is thus best suitable for usage in a pipe:

    echo 'Hello, World!' | randomart.py

There are two flags to control the output:

- `--ascii` use only ASCII characters for the box frame
- `--hash` - print the computed digest before the randomart picture

Otherwise use `randomart.py --help` for usage help.

### as a library

If you want to use your own hash you can import from `random_art.randomart`:

```python
from random_art.randomart import draw, drunkenwalk
...

# generate your hash digest
digest = ...

# generate randomart, HASHNAME must be 10 characters
art = draw(drunkenwalk(digest), HASHNAME)
print(art)
```

[^1]:

  http://www.ece.cmu.edu/~adrian/projects/validation/validation.pdf "Perrig A. and Song D., 1999,
  International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)"

[^2]:

  http://www.dirk-loss.de/sshvis/drunken_bishop.pdf "Dirk Loss, Tobias Limmer, Alexander von
  Gernler, 2009"
rattlepy 0.0.5a1
A easy-to-use pure python HTML template engine
License: MIT

Rattle.py - A Pure Python HTML Template Engine for HTML
=======================================================

.. image:: https://readthedocs.org/projects/rattlepy/badge/?version=latest
  :target: https://rattlepy.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation Status

Rattle.py is a pure python templating library for html.
And this library has no special notation like Django or Jinja.
For example:

.. code-block:: HTML

  <html>
      <head>
          <title>Hello, Rattle.py!</title>
      </head>
      <body>
          <h1 class="heading">Hello, Rattle.py!</h1>
      </body>
  </html>

The above HTML equals to below Python code with rattle.py:

.. code-block:: python

  greeting = "Hello, Rattle.py!"
  with html() as html:
    with head():
      with title():
        text(greeting)
    with body():
      with h1(className="heading"):
        text(greeting)

  # show as HTML
  print(html)

And then, you can also make reusable components by yourself:

.. code-block:: python

  def greet(name):
    with node("div", className="greet-wrapper") as component:
      with node("h1"):
        text(f"Hello, {name}=san")
      with node("button", className="ok-btn"):
        text("ok!")
    return component

  # and using:
  with greet("User"): pass

Enjoy!