Python crypto hash

Find centralized, depended on content and collaborate across the technology you use most.

Q&A for paintings

Connect and proportion information inside a single region this is established and smooth to search.


I am writing a software in Python for elliptic curve cryptography (for college and out of interest). I am presently running on the choices virtual signature set of rules. I am presently searching out a very good and secure hashing characteristic that’s both preferred in Python or can without problems be downloaded and imported. I concept about SHA256, due to the fact that it is the most effective one I recognise which hasn’t been damaged but (as far as I recognise). However, I actually have additionally read that SHA shouldn’t be used for cryptography. Is SHA256 appropriate for a virtual signature set of rules? Or should a exclusive hashing function be used? If so, which one might be a good preference?

I use SHA-512 for a similar purpose, I think you’d be hard pressed to get a great deal extra secure than that. SHA-512 is available in python’s hashlib, and can be used like so:

The satisfactory standardized algorithm presently available continues to be SHA-2. SHA-2 now includes 6 hash features: SHA-256, SHA-384 and SHA-512 have been first defined. SHA-224 become later brought to permit for a smaller output size. After that the much less nicely available SHA-512/224 and SHA-512/256 were added.

SHA-2 particularly consists of the 32-bit oriented SHA-256 variants – SHA-256 and SHA-224 – and the choices 64-bit SHA-512 variants – the choices others. The performance of the choices SHA-512 variants may also without a doubt be better on 64 bit machines, consequently the creation of SHA-512/224 and SHA-512/256. Basically the choices variations of SHA-256 / SHA-512 simplest range within the constants they use internally and the quantity of bits used as output length. Some more recent Intel and AMD processors SHA extensions that simplest accelerate SHA-256, now not SHA-512, probable shifting the choices desire once more in the direction of SHA-256 with regard to hurry.

During the choices SHA-three competition it got here to light that SHA-2 is still quite robust, despite the fact that SHA-1 is under assault. I might suggest only to look at different hashes if SHA-2 is under attack or if better hash algorithms get standardized and used.

In 2005, protection flaws were recognized in SHA-1, specifically that a mathematical weakness would possibly exist, indicating that a more potent hash feature might be perfect.[6] Although SHA-2 bears some similarity to the SHA-1 algorithm, those assaults have no longer been effectively prolonged to SHA-2.

Note that SHA-2 uses a appreciably more complicated round characteristic as compared to SHA-1. So although it has a comparable shape (both are so called Merkle-Damgard hashes) SHA-2 can be plenty extra resistant than SHA-1 against assault none-the -less.

Your Answer

Thanks for contributing a solution to Stack Overflow!

To learn greater, see our hints on writing high-quality answers.

Required, however never proven

Required, however in no way proven

By clicking “Post Your Answer”, you agree to our terms of carrier, privacy policy and cookie coverage

Not the solution you're looking for? Browse other questions tagged python python-3.x hash cryptography digital-signature or ask your personal query.

site design / brand © 2021 Stack Exchange Inc; user contributions certified beneath cc by using-sa. rev 2021.eleven.eleven.40719

By clicking “Accept all cookies”, you compromise Stack Exchange can store cookies to your device and expose records in accordance with our Cookie Policy.