I'm doing some studies/development for a security system that would use ECDH with ephemeral keys.
In my code I'm currently using a 256-bit EC, so when the two parts compute the shared secret, I get a 32B (256bit) array containing the shared secret.
Now, I would like to use this shared secret to compute a key for a symmetric key encryption algorithm, such as AES-128 (with a key size of 128 bits).
So my question is how to reduce the 256-bit shared secret to a 128-bit AES key? I have read that is better to hash the shared secret before using it as key for symmetric encryption, but with wich hashing algorithm? If I use SHA-256 I still get a 256-bit key. Is there any standard way to proceed to build a symmetric encryption key from a ECDH shared secret?