HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
thomdixon
pysha2
Python2013–2017
thomdixon / pysha2

pysha2

Pure Python implementation of SHA2 (i.e., SHA224, SHA256, SHA384, and SHA512).

2Distinct people
2Mentions
0Explicit recommenders
59GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Pure Python implementation of SHA2 (i.e., SHA224, SHA256, SHA384, and SHA512).

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 5:04:57 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year2 dated mentions

Observed mentions: 2013-09-26 21:58:33 UTC to 2017-06-28 15:51:45 UTC.

012013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2017

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC101
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC000
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC000
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC101

What Hacker News says

2 sources
[Summary: Both algorithms derive from the SHA2 specification. There's no copyright infringement here.] To make sure I understand, the project uses modified code, where the original code (at https://github.com/thomdixon/pysha2/blob/master/sha2/sha256....) is under the MIT license, but the modified version (at https://github.com/bkkcoins/klondike/blob/master/utils/sha25... ) is under the GPLv2-or-later, and doesn't attribute the original source. To answer your question, if the copyright holder believes that someone at github is infringing on copyright then the easiest thing to do is to have the copyright holder send in a DCMA notice. See https://help.github.com/articles/dmca-takedown . That said, I don't agree that there is copyright infringement. The argument is that: > The only real differences is that the derived code has been made a bit
Read the rest
more compact and less readable, the capitalization of the class has changed, a method name and a few field names were modified, and a little bit of the message/data plumbing was changed. Otherwise the core computational aspects, down to the order of operations, destructuring assignment, variable names, and auxiliary routines are all the same—all things that are hard to duplicate coincidentally. However, if you look at http://en.wikipedia.org/wiki/SHA-2#Pseudocode you'll see that it also has the same core computational aspects, variable names, etc. These all come from a common source - the SHA specification. Take a look at http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-38... and compare. What this means is the different implementers used the same reference, and not that one implementer infringed the other's copyright. While it's true that 'all things that are hard to duplicate coincidentally', there's no coincidence here. Now, remove those parts which are based directly on the standard. Those parts are quite different. Compare: def digest(self): mdi = self._counter & 0x3F length = struct.pack('!Q', self._counter<<3) if mdi < 56: padlen = 55-mdi else: padlen = 119-mdi r = self.copy() r.update('\x80'+('\x00'*padlen)+length) return ''.join([struct.pack('!L', i) for i in r._h[:self._output_size]]) -to- def finalize(self): tailbytes = self._length & 0x3f if tailbytes < 56: padding = 55 - tailbytes else: padding = 119 - tailbytes self.update(b"\x80" + (b"\0" * padding) + struct.pack("!Q", self._length << 3)) The 0x3f is another way to say "mod 64". It's something that a C programmer would think is faster, but profiling in Python just now shows that they have identical performance. Overall these implementations for how to pad is what you would expect from the algorithm. The last part of the implementations, however, are quite different. The first makes a copy() then reaches into the copy's internals. This means people can continue to update the hash even after the digest was generated. This matches the API from Python's hashlib. The latter uses an in-place modification of the hash, and the name 'finalize' reflects that it's a different implementation. It modifies state in-place, and requires a get_bytes() to get the actual bytes. This doesn't match the Python hashlib API at all. What I see is that the parts derive from the NIST specification are similar, though not identical, and the parts which don't follow naturally from that specification are quite different. Therefore I disagree with you, and say that there is no infringement.
In Ask HN: How to deal with OSS license infringement?

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.