ord() Function or ASCII Character Code of String with Z3 Solver
问题 How can I convert a z3.String to a sequence of ASCII values? For example, here is some code that I thought would check whether the ASCII values of all the characters in the string add up to 100: import z3 def add_ascii_values(password): return sum(ord(character) for character in password) password = z3.String("password") solver = z3.Solver() ascii_sum = add_ascii_values(password) solver.add(ascii_sum == 100) print(solver.check()) print(solver.model()) Unfortunately, I get this error: