Giter Site home page Giter Site logo

Hash vs Hashlib about axelbib HOT 7 OPEN

nikoleta-v3 avatar nikoleta-v3 commented on July 17, 2024
Hash vs Hashlib

from axelbib.

Comments (7)

drvinceknight avatar drvinceknight commented on July 17, 2024 1

from axelbib.

Nikoleta-v3 avatar Nikoleta-v3 commented on July 17, 2024

This post closes the issue: http://stackoverflow.com/questions/7646520/is-this-an-appropriate-use-of-pythons-built-in-hash-function

from axelbib.

drvinceknight avatar drvinceknight commented on July 17, 2024

from axelbib.

drvinceknight avatar drvinceknight commented on July 17, 2024

Also that post is just one opinion. When a reviewer or examiner says 'why did you do that?', 'stackoverflow' won't be a good answer.

from axelbib.

Nikoleta-v3 avatar Nikoleta-v3 commented on July 17, 2024
  • hash() built in function returns the hash value of the object (if it has one) of 64-bit. The 64-bit It is mainly used to quickly compare dictionary keys during a dictionary lookup. Hash() is randomised by default each time you start a new instance.

  • hashlib has 2 sets of functions:

    • MD5: Message digest algorithm producing a 128 bit hash value. This is widely used to check data integrity. It is not suitable for use in other fields due to the security vulnerabilities of MD5.
    • SHA: Group of algorithms designed by the U.S's NSA that are part of the U.S Federal Information processing standard. These algorithms are used widely in several cryptographic applications. The message length ranges from 160 bits to 512 bits.

Because we are not doing cryptography and 128 bit should be enough to avoid collusion for our data base, MD5 should be appropriate for us to use. Also I have checked that it returns same hash.

from axelbib.

drvinceknight avatar drvinceknight commented on July 17, 2024

from axelbib.

Nikoleta-v3 avatar Nikoleta-v3 commented on July 17, 2024

I will be using hashlib.md5() because it seems more appropriate for hashing and a collusion is more unlikely to happen.

from axelbib.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.