def create_salt_string():
    return (
        binascii.hexlify(
            generate_bytes(
                int(CONSTANTS.SALT_LENGTH/2)
            )
        ).decode())
def create_token_string():
    return (
        binascii.hexlify(
            generate_bytes(
                int(knox_settings.AUTH_TOKEN_CHARACTER_LENGTH/2)
            )
        ).decode())
示例#3
0
    def create(self):
        token = None
        while True:
            token = binascii.hexlify(generate_bytes(self.TOKEN_NUM_BYTES))
            if not self.filter(token=token).exists():
                break

        return super().create(token=token)
示例#4
0
文件: crypto.py 项目: vvianle/MANAGER
def create_salt_string():
    return (binascii.hexlify(
        generate_bytes(int(oneauth_settings.SALT_LENGTH / 2))).decode())
示例#5
0
文件: crypto.py 项目: vvianle/MANAGER
def create_token_string():
    return (binascii.hexlify(
        generate_bytes(int(oneauth_settings.AUTH_TOKEN_CHARACTER_LENGTH /
                           2))).decode())
示例#6
0
def create_salt_string():
    return (binascii.hexlify(generate_bytes(int(CONSTANTS.SALT_LENGTH /
                                                2))).decode())