encode keys