[Tutor] Clarification questions about how Python uses references.

Richard Damon Richard at damon-family.org
Mon Jun 28 15:51:54 EDT 2021


> On Jun 28, 2021, at 3:41 PM, Roel Schroeven <roel at roelschroeven.net> wrote:
> 
> Richard Damon schreef op 26/06/2021 om 2:59:
>> One technique uses a hash function to ultimately get a fairly small
>> number, to make lookup of values O(1) in a container.
>> The Second uses cryptographic secure hashes to verify a file. (This is
>> where MD5 is used), This use has hashes that generate BIG numbers.
> 
> Indeed. It's a bit unfortunate that the same name is used for two distinct (but related) classes of functions.
> 
> Note that MD5 "should be considered cryptographically broken and unsuitable for further use." (https://www.kb.cert.org/vuls/id/836068) SHA-1 is compromised too. For cryptographic purposes, use SHA-256 at least.
> 
They are not that distinct, they all take in an ‘object’ (or maybe a string or bytes) and generate a number that corresponds to it.

The second group DO in fact have a distinct name, they are cryptographic hashes, indicating they are (or at least claim to be or have been) suitable for cryptographic purposes.

Thinking more, there is a third middle ground where the hash is used for error detection (like.a CRC or ECC), where you want a very high probability of detecting a change, but of a ‘random’ nature, so you don’t need the ultimate security of a cryptographic hash.


More information about the Tutor mailing list