semvec/pypi-packages huggingface dataset:
miguel-lib 0.3.0b7
Random crap I like to use
Requires Python: >=3.7

.. badges-start

|CI| |pypi| |pyversion| |implementation| |license| |downloads| |black|

.. |CI| image:: https://github.com/MiguelX413/miguel_lib/actions/workflows/CI.yml/badge.svg
   :alt: GitHub Actions Build Status
   :target: https://github.com/MiguelX413/miguel_lib/actions/workflows/CI.yml

.. |pypi| image:: https://img.shields.io/pypi/v/miguel_lib.svg
   :alt: miguel_lib PyPI Project Page
   :target: https://pypi.org/project/miguel_lib/

.. |license| image:: https://img.shields.io/github/license/MiguelX413/miguel_lib.svg
   :alt: LGPL-2.1 License
   :target: https://github.com/MiguelX413/miguel_lib/blob/master/LICENSE

.. |pyversion| image:: https://img.shields.io/pypi/pyversions/miguel_lib.svg
   :alt: Supported Python Versions

.. |implementation| image:: https://img.shields.io/pypi/implementation/miguel_lib.svg
   :alt: PyPI - Implementation

.. |downloads| image:: https://pepy.tech/badge/miguel_lib/month
   :alt: PyPI Download Count
   :target: https://pepy.tech/project/miguel_lib

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

.. badges-end

Random crap I like to use

.. code-block:: console

    $ pip install miguel_lib

**miguel_lib**

- ChunksIter:
    An Iterator which takes an interator and outputs its output in groups the size of a given chunk size

- match_indices(string: str, substring: str) -> List[int]:
    Returns a list of the UTF-8 indices of disjoint matches, from start to end.

- match_utf16_indices(string: str, substring: str) -> List[int]:
    Returns a list of the UTF-16 indices of disjoint matches, from start to end.

- match_byte_indices(string: str, substring: str) -> List[int]:
    Returns a list of the byte indices of disjoint matches, from start to end.

- rmatch_indices(string: str, substring: str) -> List[int]:
    Returns a list of the UTF-8 indices of disjoint matches, from end to start.

- rmatch_utf16_indices(string: str, substring: str) -> List[int]:
    Returns a list of the UTF-16 indices of disjoint matches, from end to start.

- rmatch_byte_indices(string: str, substring: str) -> List[int]:
    Returns a list of the byte indices of disjoint matches, from end to start.

- utf16len(string: str) -> int:
    A function that returns the UTF-16 length of a string.
python-enigma 1.1.3
A simple module which adds Enigma Machine-emulating functionality to your python projects.

# python-enigma: Engima Machines, But With Python
This project introduces a package, python_enigma, with an `enigma` module which can be imported and used to include Enigma-Machine-like encryption to your python project. Also included is a simplistic "Hello World" proof of concept, a basic catalogue of rotors in the jason format expected (`catalogue.json`), and a convenience script for preparing the catalogue from a csv.

## Security Notice
In the age of gigahertz pocket computing, the Enigma cipher is useful as a point of curiosity only. None of the original security flaws with the Enigma machine as patented have been corrected.

## Historical Accuracy Notice
While pains were taken to ensure the interoperability of this emulator and the actual enigma machine, nothing about the module enforces historical accuracy in terms of the use of particular parts or settings, or the "tidying" features of the operator.

In particular, this model allows for an aribtrary number of wheels to be used, some of which were not historically used together. All wheels obey an M3/M4-style "double stepping" movement pattern. The smoother gearbox stepping patterns of some later models are not emulated.

## Making use
The principle way to use the Enigma module in your scripts is to import and invoke the Enigma class. For convenience, you can read in the string "default" as the catalog list to use the stock catalog included in the module.

The Enigma class accepts the following arguments on initialization:
- catalog: a dictionary of rotor bindings, or the string "default" to use the stock bindings included in the module.
- stecker: A space-seperated string of bindings to use for the steckerboard settings. Ex, "AB CD" means that stecker cables are set between A and B, and C and D.
- rotors: a list of tuples showing the rotor name from the catalog and the desired ringstellung letter setting, ex `[("III", "D"),]`. Any number of rotors may be used, including duplicates.
- reflector: a string indicating the name of the rotor from the rotor catalogue which you would like to use for the reflector, ex 'Reflector B'.
- operator: if True, the operator class will be used. This strips unprintable characters from the message and cuts the message into 5-character chunks.
- word_length: overrides the length of the words used by the operator.
- stator: accepts "military" or "civilian", to imitate either the direct encoding of the military version of the device or the QWERTZ encoding used in the civilian model.

Use of the Enigma class provides a variety of convenience methods:
- set_wheels: accepts a string of wheel positions (as read left to right) and applies them to be the message setting. Should be called before every parse call.
- set_stecker: if desirable, one could override the steckerboard settings after instantiating the entire machine.
- parse: parses the string provided and returns that message as though it were processed through an actual Enigma Machine.