Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize one-way hash function

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to realize one-way hash function". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. let's study and learn "how to realize one-way hash function".

One-way hash function

Before we introduce one-way hash functions, let's take a look at when one-way hash functions need to be used.

If you need to download a software from a foreign website, but for various reasons, the foreign network is too slow, it is almost impossible to download a few G data. There happens to be a mirror website in China, which can download data from the country. But how to ensure that domestic images are not tampered with? At this point, you need an one-way hash function. Generally speaking, websites will provide the value of MD5 or SHA as the verification value.

An one-way hash function has one input and one output. The input is called a message and the output is called a hash value.

The length of the hash value has nothing to do with the length of the message, no matter how long the message is, the hash value of fixed length will be calculated.

Properties of one-way hash function

One-way hash functions have the following characteristics:

A fixed-length hash value can be calculated based on a message of any length.

The speed of calculation should be fast.

Hash values vary from message to message.

This means that even a small change can cause a huge change in the entire hash value.

Because the size of the hash value is fixed, it is possible that different messages produce the same hash value. This situation is called collision.

It is difficult to find that the nature of the collision is called collision resistance. When the hash value of a message is given, it must be guaranteed that it is difficult to find another message that has the same hash value as the message.

An one-way hash function must be unidirectional. The so-called unidirectionality means that it is impossible to reverse the nature of the message by hashing values.

Implementation of one-way hash function

One-way hash functions can be implemented in many ways, and you can even write one yourself. Common ones such as MD4,MD5, MD (Message Digest) are abbreviations for message abstracts.

MD4 and MD5 were designed by Rivest in 1990 and are no longer safe.

SHA-1 is an one-way hash function designed by NIST that can generate 160bit hash values. It is no longer recommended.

SHA-256, SHA-384 and SHA-512 are also one-way hash functions designed by NIST, and their hash lengths are 256384512 bits respectively. These one-way hash functions are collectively called SHA-2.

SHA-1 was breached in 2005.

SHA-3 was established under the background that SHA-1 was breached in 2005. SHA-3 was selected through open competition, and the final selected algorithm is called Keccak algorithm.

Attack on one-way hash algorithm

The final hash value of the one-way hash algorithm has a fixed length, so we can always retry as long as we want to find two identical hash values.

Thank you for your reading. the above is the content of "how to realize one-way hash function". After the study of this article, I believe you have a deeper understanding of how to realize one-way hash function. The specific use of the situation also needs to be verified by practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report