# What kind of symmetric-key algorithm to use with Diffie-Hellman?

Let's assume we use DH with a cyclic group modulo p. As I know safe length of p must be at least 1024 bits. That means that generated key could be very big. But what do next? What kind of symmetric-key algorithm to use? DES requires key length to be exactly 56 bits. AES - 128/192/256 bits. We have no guarantee that key generated by DH will be n bits. It could be longer or even shorter. Do we have to reduce or extend key to fit it in AES or (3)DES? Or is there an algorithm that works with any key length?