Ticket #1936 (closed bug: fixed)

Opened 11 years ago

Last modified 11 years ago

SHA256 sums don't seem to match with external tools.

Reported by: DavidCzech Owned by:
Priority: normal Milestone: 3.0
Component: library Version: master
Severity: medium Keywords: gci
Cc: Language:
Patch status: Platform: all


Not sure if the SHA256 implementation is broken, or if I'm doing it wrong, but they don't seem to match up with my system's sha256sum tool, nor other external services to generate sha265 hashes.

Attached are a simple example in PIR which should output the sha256 of "blah" (8b7df143d91c716ecfa5fc1730022f6b421b05cedee8fd52b1fc65a96030ad52 according to various sources, shown below), and an file containing "blah" to use sha256sum on. The test program doesn't output the right hash:

david@animal:~/Data/GCI/kapace-parrot$ ./parrot test_sha.pir 

Online calculators and sources for checking:  http://www.xorbin.com/tools/sha256-hash-calculator (type in "blah")

  • 8b7df143d91c716ecfa5fc1730022f6b421b05cedee8fd52b1fc65a96030ad52


  • 8b7df143d91c716ecfa5fc1730022f6b421b05cedee8fd52b1fc65a96030ad52

And here is a test using my system's sha256sum tool on the sample file.

david@animal:~$ cat asdf # No newline at the end...
blahdavid@animal:~$ sha256sum asdf 
8b7df143d91c716ecfa5fc1730022f6b421b05cedee8fd52b1fc65a96030ad52  asdf


test_sha.pir Download (171 bytes) - added by DavidCzech 11 years ago.
SHA256 example program
asdf Download (4 bytes) - added by DavidCzech 11 years ago.
A test sample containing "blah" for reference with the sha256sum tool.

Change History

Changed 11 years ago by DavidCzech

SHA256 example program

Changed 11 years ago by DavidCzech

  • attachment asdf Download added

A test sample containing "blah" for reference with the sha256sum tool.

Changed 11 years ago by Yuki`N

  • status changed from new to closed
  • component changed from none to library
  • platform set to all
  • version changed from 2.11.0 to master
  • milestone set to 3.0
  • keywords gci added
  • resolution set to fixed

This is now fixed in master. An optimization, when ported over to PIR, was incorrect in some way. Implementing SHA without the optimization fixes the issue.

Note: See TracTickets for help on using tickets.