Module network_hash_gen.juniper_junos.type_6

Expand source code
from passlib.hash import sha512_crypt

from network_hash_gen.base import BaseHash


class Type6(BaseHash):
    """
    SHA2 512 bit based hash for Juniper JunOS.

    Specification: https://akkadia.org/drepper/SHA-crypt.txt
    Details:
    - 5000 rounds are used
    - the round specifier is omitted.
    """

    salt_length = 8
    salt_chars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

    @staticmethod
    def hash_salted(password: str, salt: str) -> str:
        return sha512_crypt.using(salt=salt, rounds=5000).hash(password)

Classes

class Type6

SHA2 512 bit based hash for Juniper JunOS.

Specification: https://akkadia.org/drepper/SHA-crypt.txt Details: - 5000 rounds are used - the round specifier is omitted.

Expand source code
class Type6(BaseHash):
    """
    SHA2 512 bit based hash for Juniper JunOS.

    Specification: https://akkadia.org/drepper/SHA-crypt.txt
    Details:
    - 5000 rounds are used
    - the round specifier is omitted.
    """

    salt_length = 8
    salt_chars = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

    @staticmethod
    def hash_salted(password: str, salt: str) -> str:
        return sha512_crypt.using(salt=salt, rounds=5000).hash(password)

Ancestors

Class variables

var salt_chars : str

Inherited from: BaseHash.salt_chars

A string containing all characters that can be used in a salt.

var salt_length : int

Inherited from: BaseHash.salt_length

The length of the salt.

Static methods

def hash(password: str) ‑> str

Inherited from: BaseHash.hash

Calculates the hash …

def hash_salted(password: str, salt: str) ‑> str

Inherited from: BaseHash.hash_salted

calculates a hash from a fiven password and salt. If the salt is invalid for the hash, the behaviour is undefined. Prefer the hash and hash_seeded

Expand source code
@staticmethod
def hash_salted(password: str, salt: str) -> str:
    return sha512_crypt.using(salt=salt, rounds=5000).hash(password)
def hash_seeded(password: str, seed: str) ‑> str

Inherited from: BaseHash.hash_seeded

Calculates a hash with the given seed used for generating a appropriate salt …