why it append one more letter after decode?

Ho Yeung Lee jobmattcon at gmail.com
Sun Oct 29 21:48:24 EDT 2017


def leftrotate(l, n):
    return l[n:] + l[:n]

def rightrotate(l, n):
    return l[-n:] + l[:-n]

def encode(s, k, kk):
    l = [ord(i) for i in s]
    return leftrotate(''.join([chr(i + k) for i in l]), kk)

def decode(s, k, kk):
    l = [ord(i) for i in rightrotate(s, kk)]
    return ''.join([chr(i - k) for i in l])


yesterday i add above code and run it with batch file 
it can decode a correct password

then i install cx_freeze to produce executable file

but today when i run it, i see the source of encrypted password is correct
but the decode one, it append one more letter Y at the end of string

why?
is cx_freeze change the source python 2.7?



More information about the Python-list mailing list