how to get a maximum digest length of a specific algorithm by nid

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to get a maximum digest length of a specific algorithm by nid

Dereck Hurtubise
Hello,

Is there an easy way in OpenSSL to call some function which returns the length of the digest/hash it returns? Like SHA256 would return 32 (maximum digest length of 32 bytes).

Dereck
Reply | Threaded
Open this post in threaded view
|

Re: how to get a maximum digest length of a specific algorithm by nid

michel-60
Did you see EVP_MD_size()

at http://www.openssl.org/docs/crypto/EVP_DigestInit.html


Le 12/12/2013 09:29, Dereck Hurtubise a écrit :
Hello,

Is there an easy way in OpenSSL to call some function which returns the length of the digest/hash it returns? Like SHA256 would return 32 (maximum digest length of 32 bytes).

Dereck

Reply | Threaded
Open this post in threaded view
|

Re: how to get a maximum digest length of a specific algorithm by nid

Dereck Hurtubise
How do you use EVP_MD_size() if the only thing you have is the NID of the algorithm?


On Thu, Dec 12, 2013 at 5:59 PM, Michel <[hidden email]> wrote:
Did you see EVP_MD_size()

at http://www.openssl.org/docs/crypto/EVP_DigestInit.html


Le 12/12/2013 09:29, Dereck Hurtubise a écrit :
Hello,

Is there an easy way in OpenSSL to call some function which returns the length of the digest/hash it returns? Like SHA256 would return 32 (maximum digest length of 32 bytes).

Dereck


Reply | Threaded
Open this post in threaded view
|

Re: how to get a maximum digest length of a specific algorithm by nid

Dr. Stephen Henson
On Thu, Dec 12, 2013, Dereck Hurtubise wrote:

> How do you use EVP_MD_size() if the only thing you have is the NID of the
> algorithm?
>

Call EVP_get_digestbynid() to get the EVP_MD first.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]