def get_plaintext(number): binary = Binary(number) # Random chars: #string = gen_random_string(length=128) # Random binary values: #binary.gen_random(word_size=128) #string = binary.bits # Counting values: string = binary.get_bin(word_size=128) return string
def test_get_bin(): a = Binary(3) b = Binary(10) c = Binary(8) # Test empty get. assert a.get_bin() == '11' assert b.get_bin() == '1010' assert c.get_bin() == '1000' # Test fixed-size get. assert a.get_bin(5) == '00011' assert b.get_bin(8) == '00001010' assert c.get_bin(3) == '000'