I am currently studying and implementing ECC algorithms but I encountered a problem. I want to use Secp521r1 for generating a shared key and encrypting with ECIES using AES256 but AES-256 requires a 256-bit key while the shared key is 521-bits. How can I use a 521-bit shared key for encrypting with ECIES AES-256?
Should it be hashed? If so, if I want to professionally use AES128, I could use md5 to hash the shared-key but isn't md5 considered unsafe for use?
Doesn't this many operations affect the speed of ECIES?
Another question I have is that the document: SEC, ver 1.9, on page 34 on MAC generations says:
- Convert M to a bit string M and K to a bit string K using the conversion routine specified in Section 2.3.2.
I do not understand why I should convert the shared key to a bit string while HMAC_SHA512 gets key input as a byte array. The document also suggests the same thing for encryption specified in Section 3.8.3.