encrypt.py: port table to support python 3 (recreated)

Recreated PR agaisnt `dev` branch.