当前位置:网站首页>Quickly understand the commonly used message summarization algorithms, and no longer have to worry about the thorough inquiry of the interviewer
Quickly understand the commonly used message summarization algorithms, and no longer have to worry about the thorough inquiry of the interviewer
2022-06-24 13:13:00 【51CTO】
interviewer : Tell me about your common encryption algorithms ?
Encryption algorithms are usually divided into two types : Symmetric encryption and Asymmetric encryption . among , Symmetric encryption algorithm uses the same key for encryption and decryption ; Asymmetric encryption algorithm uses different keys for encryption and decryption , It is divided into public key and private key . Besides , There is also a class called Message digest algorithm , It is an irreversible algorithm for summarizing data .
This time, let's look at the message digest algorithm .
Message digest algorithm
The message digest algorithm is an algorithm that combines inputs of any length to produce pseudo-random results of fixed length . In information security , There are many important applications , Message digest algorithm is used to realize , E.g. digital signature 、 Message authentication code .
For any given data , Message digest algorithms can easily calculate the digest results . It is difficult to get a known summary result , To calculate the original data . Without changing the summary results , It is not feasible to modify the data content . For two different data , There is only a very low probability that the same summary results will be produced .
The common symmetric encryption algorithms are :MD5 Algorithm 、SHA.
MD5 Algorithm
MD5 Algorithm (Message Digest 5) It's a cryptographic hash function , Produce a 128 Hash value of bits , You can use a length of 32 The hexadecimal string of represents .
MD5 The algorithm was developed by American cryptologists Ronald Linn Rivest( This big guy invented RSA Algorithm R) The design of the , On 1992 Open in , To replace the previous MD4 Algorithm ( And before that MD3 Algorithm 、MD2 Algorithm ).
MD5 The algorithm divides the original data into groups 512 Bit size , Then each group is divided into 16 individual 32 Group the seats , And then with the pre-defined 4 A magic number performs a series of bit operations , Finally, I got four 32 A group of , Put these four 32 After the concatenation of bit groups, a 128 Bit hash value .
We use it Java Write an example :
The operation results are as follows :
2004 year ,MD5 The algorithm proved unable to prevent collision attack , So it doesn't apply to security certification .
2009 year , Xie Tao and Feng Dengguo of the Chinese Academy of Sciences only used The complexity of the collision algorithm , It's broken MD5 Collision resistance of , This attack only takes a few seconds to run on a normal computer .
2011 year ,IETF(Internet Engineering Task Force, Internet Engineering Task Force ) Release RFC 6151, prohibit MD5 Used as key hash message authentication code .
All in all ,MD5 It's no longer safe , Don't use it any more .
SHA
SHA(Secure Hash Algorithm, Secure hash algorithm ) Is a family of cryptographic hash functions , yes FIPS(Federal Information Processing Standards, Federal Information Processing Standards ) Authenticated secure hash algorithm .
SHA The family contains a set of algorithms that have evolved over time , Yes 1993 Published in SHA-0、1995 Published in SHA-1、2001 Published in SHA-2、2015 Published in SHA-3.

Due to MD5 A successful solution , And right SHA-0 and SHA-1 There is a theoretical solution to the problem , Therefore, it is recommended to use SHA-2, Or safer SHA-3.
We use it Java Write a SHA-2 Example :
The operation results are as follows :
JDK8 The following versions do not support SHA-3, So when you run the above code, there will be NoSuchAlgorithmException: SHA3-256 MessageDigest not available abnormal .
summary
The message digest algorithm is an algorithm that combines inputs of any length to produce pseudo-random results of fixed length . The common symmetric encryption algorithms are :MD5 Algorithm 、SHA.
MD5 The algorithm should not be used any more .SHA In the family , Recommended SHA-2, Or safer SHA-3.
边栏推荐
- MySQL foreign key impact
- 短信服务sms
- Parse NC format file and GRB format file dependent package edu ucar. API learning of netcdfall
- Use terminal to activate CONDA service in pypharm (the ultimate method is definitely OK)
- 手把手教你用AirtestIDE无线连接手机!
- IIS WCF 808 port service access exception
- 简述聚类分析
- 如何高效的分析online.log
- ‘高并发&高性能&高可用服务程序’编写及运维指南
- 生成 4维 的 气压温度的 nc文件,之后进行代码读取(提供代码)
猜你喜欢

LVGL库入门教程 - 颜色和图像

巴比特 | 元宇宙每日必读:618成绩已然揭晓,在这份还算满意的答卷背后,数字藏品做出了多少贡献?...

使用 Abp.Zero 搭建第三方登录模块(一):原理篇

Definition and use of constants in C language
![[data mining] final review (sample questions + a few knowledge points)](/img/90/a7b1cc2063784fb53bb89b29ede5de.png)
[data mining] final review (sample questions + a few knowledge points)

微医CodeReview工具链

Dingding, Feishu, and enterprise wechat: different business approaches

Teach you how to use airtestide to connect your mobile phone wirelessly!

一文讲透研发效能!您关心的问题都在

About the hacked database
随机推荐
Engage in audio and video development? Several things I have to say about SRT live broadcast protocol
Smart Policing: how to use video intelligent analysis technology to help urban policing visual comprehensive supervision and command system
Encapsulate the method of converting a picture file object to Base64
用一个软件纪念自己故去的母亲,这或许才是程序员最大的浪漫吧
[highlights] summary of award-winning activities of Tencent cloud documents
快速了解常用的消息摘要算法,再也不用担心面试官的刨根问底
Mlife forum | microbiome and data mining
Perhaps the greatest romance of programmers is to commemorate their dead mother with a software
Getting started with the go Cobra command line tool
Implement Domain Driven Design - use ABP framework - create entities
申请MIMIC数据库失败怎么办?从失败到成功的经验分享给你~
[2022 national tournament simulation] BigBen -- determinant, Du Jiao sieve
On the value foam of digital copyright works from the controversial nature of "Meng Hua Lu"
Getting started with the lvgl Library - colors and images
How to make secruecrt more productive
使用 Abp.Zero 搭建第三方登录模块(一):原理篇
Optimization of MP4 file missing seconds caused by TS files when downloading videos from easydss video platform
J'a i ouvert quelques mots d'un ami et quelques réflexions personnelles sur le livre des six ancêtres
[live broadcast of celebrities] elastic observability workshop
Kubernetes集群部署