encode and decode files for error correction