SHA 512 hash in C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • benaroia

    SHA 512 hash in C++

    I'm creating a simple hashing program and wish to use the SHA hash in
    it. I was wondering if there was an easy way to do that. In Ruby you
    can just say:
    require "Digest"
    sha_hex = Digest::SHA512. hexdigest("some string")
    print sha_hex

    Is there a comparable way to do this in c++? I would like to have the
    speed it offers instead of having to wait for ruby.

    Thanks!
  • Jeff Schwab

    #2
    Re: SHA 512 hash in C++

    benaroia wrote:
    I'm creating a simple hashing program and wish to use the SHA hash in
    it. I was wondering if there was an easy way to do that. In Ruby you
    can just say:
    require "Digest"
    sha_hex = Digest::SHA512. hexdigest("some string")
    print sha_hex
    >
    Is there a comparable way to do this in c++? I would like to have the
    speed it offers instead of having to wait for ruby.
    You will probably need a third-party library like OpenSSL. If you're on
    a Unix-like platform, such a library should already be installed; try
    "man crypto". OpenSSL is written in C, but Google also turns up various
    C++ implementations , including wrappers around OpenSSL.

    Comment

    • benaroia

      #3
      Re: SHA 512 hash in C++

      "man crypto". OpenSSL is written in C, but Google also turns up various
      Interesting. I looked up Crypto++ and it was quite interesting, but I
      seem to be having trouble with some of the how-to. There is a
      CalculateDigest method for SHA512, but I seem to be over my head in C+
      + syntax. Any more help?
      Thanks,

      Comment

      • Jeff Schwab

        #4
        Re: SHA 512 hash in C++

        benaroia wrote:
        >"man crypto". OpenSSL is written in C, but Google also turns up various
        Interesting. I looked up Crypto++ and it was quite interesting, but I
        seem to be having trouble with some of the how-to. There is a
        CalculateDigest method for SHA512, but I seem to be over my head in C+
        + syntax. Any more help?
        Can you post a complete program that won't compile for you, or isn't
        doing what you expect?

        Comment

        Working...