Add encode/decode functions into key2pho.