We consider the question of recovering the phase of an object from intensity-only measurements, a problem which naturally appears in X-ray crystallography and related disciplines. We study a physically realistic setup where one can modulate the signal of interest and then collect the intensity of its diffraction pattern, each modulation thereby producing a sort of coded diffraction pattern. We show that a convex relaxation of the problem, recovers the phase information exactly from a minimal number of random modulations. Time permitting we will also present very fast alternatives to convex optimization with similar theoretical guarantees that are near optimal in terms of usage of computational and data resources. This is joint work with Emmanuel Candes and Xiaodong Li