コード例 #1
0
def choose_best_test():
	analyzer = EnglishAnalyzer()
	secret_password = 23
	plaintext = "A dyslexic man walks into a bra."
	ciphertext = single_byte_xor(plaintext, 23)

	potential_plaintexts = ( single_byte_xor(ciphertext, i) for i in range(255) )

	assert analyzer.choose_best(potential_plaintexts)[0] == plaintext
コード例 #2
0
def choose_best_test():
    analyzer = EnglishAnalyzer()
    secret_password = 23
    plaintext = "A dyslexic man walks into a bra."
    ciphertext = single_byte_xor(plaintext, 23)

    potential_plaintexts = (single_byte_xor(ciphertext, i) for i in range(255))

    assert analyzer.choose_best(potential_plaintexts)[0] == plaintext