EVP_SHA224(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’– NAME πŸ’–

ok so bestie, this whole page is about the SHA-2 For EVP squad β€” that's EVP_sha224, EVP_sha256, EVP_sha512_224, EVP_sha512_256, EVP_sha384, and EVP_sha512. that's the lineup. that's the girlies. from the 3ossl manual, mwah πŸŽ€


✨ SYNOPSIS ✨

like literally just include the header first, no biggie:

#include <openssl/evp.h>

and then these six icons, each one handing you back a const EVP_MD *:

const EVP_MD *EVP_sha224(void);
const EVP_MD *EVP_sha256(void);
const EVP_MD *EVP_sha512_224(void);
const EVP_MD *EVP_sha512_256(void);
const EVP_MD *EVP_sha384(void);
const EVP_MD *EVP_sha512(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so context first: SHA-2 (Secure Hash Algorithm 2) is a whole family of cryptographic hash functions, standardized in NIST FIPS 180-4, first published in 2001. vintage! but still slaying πŸ’…

🌸 the functions 🌸

  • EVP_sha224(), EVP_sha256(), EVP_sha512_224, EVP_sha512_256, EVP_sha384(), EVP_sha512() β€” these are the SHA-2 SHA-224, SHA-256, SHA-512/224, SHA512/256, SHA-384 and SHA-512 algorithms, and they generate 224, 256, 224, 256, 384 and 512 bits respectively of output from a given input. yes the 224 shows up twice, that's not a typo, that's just how it is bestie πŸ™ˆ

and here's the part that trips people up, so listen: the two algorithms SHA-512/224 and SHA512/256 are truncated forms of the SHA-512 algorithm. they are distinct from SHA-224 and SHA-256 even though their outputs are of the same size. same size β‰  same thing, no cap. don't be out here swapping them like they're dupes 🫢


πŸ‘‘ NOTES πŸ‘‘

ok real talk, this one matters: developers should be aware of the negative performance implications of calling these functions multiple times, and should consider using EVP_MD_fetch(3) with EVP_MD-SHA2(7) instead. that's a "do better for your perf" moment fr fr. see "Performance" in crypto(7) for further information β€” go read it, i'll wait πŸ’€


πŸŽ€ RETURN VALUES πŸŽ€

these functions return a EVP_MD structure that contains the implementation of the message digest. that's the whole vibe. see EVP_MD_meth_new(3) for details of the EVP_MD structure if you wanna get into the lore ✨


🌈 CONFORMING TO 🌈

NIST FIPS 180-4. that's it. that's the standard. periodt ⭐


πŸ“ SEE ALSO πŸ“

go click around, it's giving rabbit hole in the best way iykyk 🧚


Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


ok that's the page!! mwah, love u, go hash something responsibly πŸ’–βœ¨ version 3.5.0, dated 2026-09-25 β€” and it's EVP_SHA224(3ossl), signing off πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from