Example #1
0
    def __init__(self, *args, **kwargs):
        """Initialize attributes lazily.

        :param args: Arguments.
        :param kwargs: Keyword arguments.
        """
        super().__init__(*args, **kwargs)
        self._person = Person
        self._address = Address
        self._datetime = Datetime
        self._business = Business
        self._text = Text
        self._food = Food
        self._science = Science
        self._code = Code
        self._transport = Transport
        self.unit_system = UnitSystem(seed=self.seed)
        self.file = File(seed=self.seed)
        self.numbers = Numbers(seed=self.seed)
        self.development = Development(seed=self.seed)
        self.hardware = Hardware(seed=self.seed)
        self.clothing_size = ClothingSize(seed=self.seed)
        self.internet = Internet(seed=self.seed)
        self.path = Path(seed=self.seed)
        self.payment = Payment(seed=self.seed)
        self.games = Games(seed=self.seed)
        self.cryptographic = Cryptographic(seed=self.seed)
        self.structure = Structure(seed=self.seed)
Example #2
0
    def password(self, length: int = 8, algorithm: str = None) -> str:
        """Generate a password or hash of password.

        :param int length: Length of password.
        :param str algorithm: Hashing algorithm.
        :return: Password or hash of password.

        :Example:
            k6dv2odff9#4h (without hashing).
        """
        text = ascii_letters + digits + punctuation
        password = ''.join([self.random.choice(text) for _ in range(length)])

        if algorithm is not None:
            crypto = Cryptographic()
            return crypto.hash(algorithm)

        return password
Example #3
0
    def password(self, length: int = 8, hashed: bool = False) -> str:
        """Generate a password or hash of password.

        :param length: Length of password.
        :param hashed: MD5 hash.
        :return: Password or hash of password.

        :Example:
            k6dv2odff9#4h
        """

        text = ascii_letters + digits + punctuation
        password = ''.join([self.random.choice(text) for _ in range(length)])

        if hashed:
            crypto = Cryptographic()
            return crypto.hash(algorithm=Algorithm.MD5)
        else:
            return password
Example #4
0
    def ethereum_address() -> str:
        """Get random dummy Ethereum address.

        .. Note: The address will look like Ethereum address,
        but keep in mind that it is not the valid address.
        It is just a SHA1 hash with prefixed 0x.

        :return: Ethereum address.

        :Example:
            0xe8ece9e6ff7dba52d4c07d37418036a89af9698d
        """
        sha1 = Cryptographic('en').hash(Algorithm.SHA1)
        return '0x{hash}'.format(hash=sha1)
Example #5
0
    def password(self, length=8, algorithm=None):
        """Generate a password or hash of password.

        :param length: Length of password.
        :param algorithm: Hashing algorithm.
        :return: Password or hash of password.
        :Example:
            k6dv2odff9#4h (without hashing).
        """
        password = ''.join([
            self.random.choice(ascii_letters + digits + punctuation)
            for _ in range(int(length))
        ])

        if algorithm is not None:
            return Cryptographic().hash(algorithm=algorithm)

        return password
Example #6
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self._personal = Personal
     self._address = Address
     self._datetime = Datetime
     self._business = Business
     self._text = Text
     self._food = Food
     self._science = Science
     self._code = Code
     self.unit_system = UnitSystem()
     self.file = File()
     self.numbers = Numbers()
     self.development = Development()
     self.hardware = Hardware()
     self.clothing_sizes = ClothingSizes()
     self.internet = Internet()
     self.transport = Transport()
     self.path = Path()
     self.games = Games()
     self.cryptographic = Cryptographic()