Skip to main content

Network Hash Gen

Generating hashes for network devices like routers and switches - with the option to specify seeds or salts.

Currently supported hashes:

  • Cisco IOS/IOS-XE
    • Type 5
    • Type 9
  • Juniper JunOS
    • Type 1
    • Type 6
    • Type 9

If you are missing a hash function, please open an issue.

Example

This example generates a hash with a random salt and a hash with a given seed. The first function returns a different hash most of the times while the second one always returns the same hash value.

>>> from network_hash_gen.cisco_ios import Type9
>>> Type9.hash("foobar")
'$9$FteIXKc69u9886$JFenYTrYz7kgex.60fbd8kzIg3Y/fE8lhsrtZeiif8k'
>>> Type9.hash_seeded("foobar", "$hostname-$username")
'$9$XpsDCh72ruxTQc$Cm80vIgCAQPhWrLJczX53Z7qVg0AxKui6t8.QbWfBsU'

Installation

This package can be installed from PyPi via pip or whatever you prefer for dependency management.

pip install network-hash-gen

Documentation

The documentation build against the current master branch can be found here: https://991jo.github.io/network_hash_gen

To build the documentation for a specific version run

pdoc3 --html --template-dir=templates network_hash_gen

This will generate documentation in a folder called html.

Development

Setup

This project uses poetry.

Clone this repository, then run

poetry install

This will create a venv and install the dev dependencies.

Running the tests

The tests are in the tests folder and are executed with

python3 -m unittest

The unittests are also run via the pre-commit hooks.

To get test coverage reports coverage is used. Run

coverage run -m unittest

to run the tests and coverage report for a CLI report of coverage html to generate a HTML version of the coverage report.

Code Formatting

The code in this repository is formated with black. The default settings are used. Please format the code with black before commiting. This can be done with

black network_hash_gen/

The code formatting is also checked (but not executed) in the commit hooks.

Pre-Commit Hooks

There are pre-commit hooks that check the code formating and run the unittests. They are executed via pre-commit. To enable the hooks run

pre-commit install

To run the hooks on all files execute

pre-commit run --all-files

Metadata

Release files for network-hash-gen 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for network-hash-gen 0.3.0
File Size Uploaded Provenance Actions
network_hash_gen-0.3.0.tar.gz 19.9 kB Without provenance Details for network_hash_gen-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for network-hash-gen 0.3.0
File Interpreter ABI Platform Actions
network_hash_gen-0.3.0-py3-none-any.whl Python 3 none any Details for network_hash_gen-0.3.0-py3-none-any.whl

Total release size: 41.9 kB

Release files / network_hash_gen-0.3.0.tar.gz

Download URL network_hash_gen-0.3.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5851f51d4e0f51bfd745f73b14313eba1cc10de0694a8484220771f08885500e
BLAKE2b-256 checksum
How to use checksums
e6776181168d468df6eac17613adc2a7ed10e4997703bb0e71090c4e2ea20088
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.16.12-arch1-1

Release files / network_hash_gen-0.3.0-py3-none-any.whl

Download URL network_hash_gen-0.3.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0676434f67071725ce5db2f719cc592ca264ee4cf200861d69da7765d4c32433
BLAKE2b-256 checksum
How to use checksums
50efae8a88e69bf22fd626a0fa839582ecd99082084e145aa10b34cbb746d05e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.16.12-arch1-1

Security for network-hash-gen 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page