def encrypt(plain_text, passwd): c = PyCrypto(passwd) s, ct = c.encrypt(plain_text + _KNOWN_STR) return (s + ct).encode('base64')