We present a new method for generation of relativistic electron beams with current modulation on the nanometer scale and below. The current modulation is produced by diffracting relativistic electrons in single crystal Si, accelerating the diffracted beam and imaging the crystal structure, then transferring the image into the temporal dimension via emittance exchange. The modulation period can be tuned by adjusting electron optics after diffraction. This tunable longitudinal modulation can have a period as short as a few angstroms, enabling production of coherent hard x-rays from a source based on inverse Compton scattering with total accelerator length of approximately ten meters. Electron beam simulations from cathode emission through diffraction, acceleration and image formation with variable magnification are presented along with estimates of the coherent x-ray output properties.