moving encode so encrypt work with file