Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 725333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:19:31+00:00 2026-05-14T06:19:31+00:00

How do I use the sha512 function for PHP? Can I replace all my

  • 0

How do I use the sha512 function for PHP?

Can I replace all my md5 functions with the sha512 function?

Do I have to download something if so what?

Can anyone provide examples?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:19:31+00:00Added an answer on May 14, 2026 at 6:19 am

    The hash() function, provided with PHP >= 5.1, should be able to generate sha512 hashes — you can verify this calling the hash_algos() function, that lists the supported hashing algorithms.

    For example, you could use :

    $sha512 = hash('sha512', "Hello, World!");
    var_dump($sha512);
    

    And you’d get :

    string '374d794a95cdcfd8b35993185fef9ba368f160d8daf432d08ba9f1ed1e5abe6cc69291e0fa2fe0006a52570ef18c19def4e617c33ce52ef0a6e5fbe318cb0387' (length=128)
    

    And, on my system, the following portion of code :

    $supported = hash_algos();
    var_dump($supported);
    

    Indicates that 42 hashing algorithms are supported :

    array
      0 => string 'md2' (length=3)
      ...
      6 => string 'sha384' (length=6)
      7 => string 'sha512' (length=6)
      8 => string 'ripemd128' (length=9)
      9 => string 'ripemd160' (length=9)
      ...
      40 => string 'haval224,5' (length=10)
      41 => string 'haval256,5' (length=10)
    


    Also, with PHP >= 5.3, you should be able to use the openssl_digest() function :

    $sha512 = openssl_digest("Hello, World!", 'sha512');
    var_dump($sha512);
    

    (Yep, the parameters are not in the same order as with hash() — the magic of PHP, here…)

    And, to get the list of supported algorithms, you could use openssl_get_md_methods().

    On my system, this one gives me 22 supported algorithms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if I use PHP's hash() function to generate sha512 hashes how
I have this PHP function (using PHP 5.3) that I use to decrypt files,
SHA384 is a truncated version of SHA512. But why would anyone use it? And
I have the following function that I use to check a user login, at
I use a php script that hashes passwords using php's crypt and uses SHA512,
I am attempting to use OpenSSL's SHA512 function in a C++ project of mine.
I use Symfony 2 and the FOSUserBundle. I can login, logout and view Profile.
I wrote this function in php to check user/pass against account on linux server.
I'd prefer to use the crypt function and use blowfish encryption, but the current
Possible Duplicate: Best way to use PHP to encrypt and decrypt? I am new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.