Fragmentation cross sections at intermediate energies for hadrontherapy and space radiation protection