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

  • Home
  • SEARCH
  • 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 7492849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:36:51+00:00 2026-05-29T16:36:51+00:00

Possible Duplicate: Why is an MD5 hash created by Python different from one created

  • 0

Possible Duplicate:
Why is an MD5 hash created by Python different from one created using echo and md5sum in the shell?

I just saw this, and I don’t get it. Do I not know something about php’s internal… something? Or are there assumptions I’m making about… something? That don’t hold true?

$ sha512sum <(echo 'hello')
e7c22b994c59d9cf2b48e549b1e24666636045930d3da7c1acb299d1c3b7f931f94aae41edda2c2b207a36e10f8bcb8d45223e54878f5b316e7ce3b6bc019629  /proc/self/fd/11

and also:

$ echo 'hello' | sha512sum
e7c22b994c59d9cf2b48e549b1e24666636045930d3da7c1acb299d1c3b7f931f94aae41edda2c2b207a36e10f8bcb8d45223e54878f5b316e7ce3b6bc019629  -

but then:

php -a
Interactive shell
php > echo hash('sha512', 'hello');
9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043

∅ cat hashtest.php 
<?php
echo hash('sha512', 'hello');
?>
∅ php hashtest.php 
9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043

What’s the deal? I’m on Linux x86_64, and my system text encoding is utf-8, and these are all ascii-range characters. I don’t know what I’m overlooking.

Interestingly, for some value of “interesting”, Python agrees with PHP:

>>> hashlib.sha512(b'hello').hexdigest()
'9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043'

Honestly, despite my humble opening, I assumed that this was some sort of massive and unknown PHP bug. But I guess not.

  • 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-29T16:37:04+00:00Added an answer on May 29, 2026 at 4:37 pm
    $ php -a
    Interactive shell
    
    php > echo hash('sha512', "hello\n");
    e7c22b994c59d9cf2b48e549b1e24666636045930d3da7c1acb299d1c3b7f931f94aae41edda2c2b207a36e10f8bcb8d45223e54878f5b316e7ce3b6bc019629
    

    The standard echo command includes a trailing newline. Try echo -n for identical results.

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

Sidebar

Related Questions

Possible Duplicate: MD5 algorithm in Objective C I need to hash a string using
Possible Duplicate: Generate MD5 hash in Java Can some one tell me how to
Possible Duplicate: How do you send email from a Java app using Gmail? How
Possible Duplicate: How come MD5 hash values are not reversible? I was reading a
Possible Duplicate: In C++, How to get MD5 hash of a file? I am
Possible Duplicate: Will the MD5 cryptographic hash function output be same in all programming
Possible Duplicate: Generate a Hash from string in Javascript/jQuery Can anyone suggest a simple
Possible Duplicate: Generate MD5 hash in Java Hi, I want to compute the MD5
Possible Duplicate: Reversing an MD5 Hash Given this method in c# public string CalculateFileHash(string
Possible Duplicate: Is it possible to decrypt md5 hashes? In my website, I'm using

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.