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

Recreated PR against `dev` branch.