We have implemented a deterministic method for solving the phase problem in hard x-ray in-line holography which overcomes the twin image problem. The phase distribution in the detector plane is retrieved by using two images with slightly different Fresnel numbers. We then use measured intensities and reconstructed phases in the detection plane to compute the exit wave in the sample plane. No further a priori information like a limited support or the assumption of pure phase objects is necessary so that it can be used for a wide range of complex samples. Using a nano-focused hard x-ray beam half period resolutions better than 30 nm are achieved.