더북(TheBook)
def get_crypto_hash(password: str) -> str:
    return hashlib.sha256(password.encode()).hexdigest()
def check_password(expected_crypto_hash: str,
                   possible_password: str) -> bool:

    actual_crypto_hash = get_crypto_hash(possible_password)
    return expected_crypto_hash == actual_crypto_hash

 

def crack_password(crypto_hash: str, length: int) -> None:
    print("Processing number combinations sequentially")
    start_time = time.perf_counter()

    combinations = get_combinations(length=length)
    for combination in combinations:
        if check_password(crypto_hash, combination):
            print(f"PASSWORD CRACKED: {combination}")
            break
    process_time = time.perf_counter() - start_time
    print(f"PROCESS TIME: {process_time}")


신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.