当前位置:网站首页>Encryption and encoding resolution
Encryption and encoding resolution
2022-06-25 00:21:00 【BY-91】
List of articles
Classical cryptography
Originated in Ancient Wars : In the war , In case of ⽌ Important information leaked after the letter was intercepted ,⼈ They began to read books
Xinjin ⾏ encryption .
Shift encryption
Like a password stick , send ⽤ The strips of cloth wound around ⽊ On the stick ⽅ In this way, we can write letters ⾏ encryption
encryption algorithm : Write after winding secret key :⽊ Great ruler ⼨
Alternative encryption
Make by the rules ⽤ Different ⽂ Words to replace the original ⽂ Words come in ⾏ encryption .
Modern cryptography
- You can encrypt anything ⼆ Hexadecimal data
- ⾮ With the advent of symmetric encryption, cryptography has become more and more popular ⼴ General ⽤ Way : digital signature
Symmetric encryption
- Communication double ⽅ send ⽤ Same as ⼀ Key , send ⽤ Encryption algorithm with key to encrypt , Decrypt with ⽤ The encryption process
The complete inverse of the process with the key to enter ⾏ Decrypt . - characteristic : Encryption is decryption using the same key , But encryption and decryption algorithms are different , Decryption algorithm is the inverse operation of encryption algorithm .
- Algorithm :DES(56 A key , The key is too short ⽽ Gradually abandoned ⽤)、AES(128 position 、192 position 、256 A key ,
Now it's the most current ⾏) - Symmetric encryption functions : Protect communications , prevent ⽌ Information is not secure ⽹ After the network was intercepted , Information is ⼈ Read or tamper with .
- Symmetric encryption cracking risk : Because the encryption and decryption keys are the same , For example, on a landing site , Once the key is intercepted , And then the crazy registration operation of the website , You can get a lot of original texts - The ciphertext is right , At the same time, there is the original data after decryption , So there is a certain probability that you can try out the key content , To crack the key , This is man in the middle attack . This probability can only be reduced by optimizing the encryption algorithm .
- The disadvantages of symmetric encryption : As mentioned above , The key cannot be transmitted over an insecure network , It's easy to leak the key , But the Internet is often insecure .
- Symmetric encryption process diagram :

⾮ Symmetric encryption
principle :⾮ Symmetric encryption keys are one to two ( Public and private keys ), send ⽤ The public key enters into the data ⾏ Encrypts get encrypted ⽂; send ⽤ The private key enters the data ⾏ Decrypt the original data . The diagram is as follows :

advantage : As shown in the figure above , send ⽤⾮ Symmetric encrypted communication , Can be in untrustworthy ⽹ There will be two ⽅ Pass the public key of to ⽅, Before data transmission , The sender uses the other party's public key to encrypt the original data , After sending it , The receiver uses its private key to decrypt .
characteristic : The encryption key and decryption key of asymmetric encryption are different , But the encryption algorithm is the same .
effect : The public key and private key of asymmetric encryption are mutually solvable , therefore ⾮ Symmetric encryption can also respond to ⽤ Digital signature technology .
Signature and authentication :
① The sender and receiver hold their own private key and the other party's public key respectively as follows :
②. The sender uses its own private key and encryption algorithm to sign the original data , And then send it to the receiver along with the original data , The receiver uses the sender's public key to decrypt the signature data to get the original data , Compare and verify with the original data .
③ This actually sends the original data twice , The usual practice is that the original data cannot be transmitted on the network , There is a risk of leakage , Instead, we do the original data once before sending it hash Algorithm ( Irreversible ) Generate summary , Then use your private key to hash After the signature of the data digest , Then put the signed abstract on the original data hash After the summary sent out . The receiver uses the sender's public key to decrypt the signed digest to get the original data hash Later data , And then it's sent to you hash After the original data comparison , To verify the consistency . That is to say, the original data is not transmitted directly , It's not encrypted , It's about delivering it hash value , The receiver does not save the original data ( Similar to the server does not save the password , Just save the password hash value )
5. Asymmetric encryption algorithm :RSA( can ⽤ For encryption and signature )、DSA( only ⽤ In signature , But faster )
6. ⾮ Advantages and disadvantages of symmetric encryption : It can be in an unsafe place ⽹ The key is transmitted over the network , Because it's a public key , But the computation is complicated , Performance will be much worse than symmetric encryption .
7. Crack the risk : Common passwords may be collected in rainbow tables .
hash Algorithm
- Definition : Convert arbitrary data to specified ⼤⼩ Range ( It's usually very ⼩, for example 256 Bytes within ) The data of
- effect ①: Extract summary information from data , So the main thing is ⽤ It's digital fingerprints .
- effect ②: Fast only ⼀ Validation , for example Java Medium hashCode() ⽅ Law , Can quickly verify the inequality of two values .
- effect ③: Data integrity verification . For example, from ⽹ Download ⽂ After that , adopt ⽐ Yes ⽂ Piece Hash value ( for example MD5、SHA1,SHA256 All belong to hash Algorithm , It's all irreversible ), You can confirm the download ⽂ Is there any damage to the parts . If you download ⽂ Pieces of Hash Values and ⽂ It provides ⽅ Given Hash value ⼀ Cause , It proves that the downloaded ⽂ It's in good condition ⽆ It's a loss .
- effect ④: Quick search , for example HashMap, Arrays are used internally , By calculation key Of HashCode() Direct positioning value The index , There's no need to traverse the entire array .
- effect ⑤: Privacy protection , When important data has to be exposed , There's something you can choose to expose Hash value ( for example MD5), To ensure the security of the original data . for example ⽹ When you log in at the station , You can just save ⽤ The password of the user Hash value , In each login verification, you only need to input ⼊ Of the code Hash Value and the... Stored in the database Hash It's worth it ⽐ That's right ,⽹ standing ⽆ Need to know ⽤ The password of the user . such , When ⽹ When station data is stolen ,⽤ It's not because ⾃⼰ Your password was stolen, causing other ⽹ The security of the station is also threatened , however hash The algorithm does not belong to encryption , Because it's a one-way irreversible operation . And it doesn't belong to coding , Because encoding corresponds to decoding , It's reversible .
Encoding and decoding
- Definition : To encode is to take data from ⼀ Convert one data format to another ⼀ Data formats . Decoding is the same . It's also reversible , There's coding, there's decoding .
Base64 code
- Definition : take ⼆ Hexadecimal data ( All the computer data is ⼆ Hexadecimal data ) Convert to by 64 The encoding algorithm for a string of characters ,
- Algorithm : Put the original data every 6 Bit correspondence Base 64 In the index table ⼀ Two characters arranged into ⼀ A string ( Each character 8 position ),base64 The index table is as follows :

- Base64 Of ⽤ Way : take ⼆ Binary data expands the way of storage and transmission . Ordinary strings go through Base64 The result of coding will become ⾁ The eye can't read .
- Base64 The shortcomings of : because ⾃ The principle of the body (6 Displacement 8 position ), So every time Base64 After coding , The data will increase ⼤ about 1/3, So it will affect the storage and transmission performance . therefore Use base64 It is not efficient to encode and transmit pictures ( Because the volume increases ), It won't be safe either ( because base64 It's coding , It's reversible , It can be decoded )
variant :Base58,⽐ Special currency envoy ⽤ The coding ⽅ type , Removed Base64 Number in “0”, word ⺟⼤ Write “O”, word ⺟⼤ Write
“I”, He Zi ⺟⼩ Write “l”, as well as “+” and “/” Symbol ,⽤ On ⽐ The representation of special currency address .
Base58 about Base64 The changes to the , The main ⽬ What's important is ⽤ The convenience of households . By removing the indistinguishable
character , bring Base58 about 「⼈⼯ Copy 」 more ⽅ then . in addition , Removed “+” “/” After the number one, let ⼤
Most software can ⽅ Double click to select
URL send ⽤ Percent sign code of
stay URL In the string of , Yes ⼀ Some No ⽤ For special ⽤ The reserved character of the path , send ⽤ Percent sign “%” Enter... For prefix
⾏ code , To avoid parsing errors .
Compression and decompression coding
Compress : Put the data so that ⽤ The coding algorithm with more storage advantages is introduced ⾏ code .
decompression : Decode compressed data back to its original form , With ⽅ So that ⽤
The purpose is to reduce costs ⼩ Data take up ⽤ Storage space .
serialize
Put the data object (⼀ It's in memory , for example JVM Objects in the ) The process of converting to a sequence of bytes . object
In program memory ⾥ The storage form is scattered ( Stored in different memory areas 、 And it's led by ⽤ Into the ⾏ even
Pick up ), Through serialization, objects in memory can be converted to ⼀ A sequence of bytes , from ⽽ send ⽤ Byte array byte[] Isomorphism
Step in ⾏ Local storage or ⽹ Network transmission , Reassemble when needed ( Deserialization ) To make ⽤. The goal is to allow objects in memory to be stored and transferred .
serialize It's not coding , Encoding is the transfer of data from ⼀ Convert one data format to another ⼀ Data formats ;⽽ Serialization is the transfer of data from objects in memory (⽽ It's not a specific format ) Convert to a sequence of bytes
边栏推荐
- 【面试题】instancof和getClass()的区别
- December 6, 2019 what happens after the browser enters a URL
- The third generation of power electronics semiconductors: SiC MOSFET learning notes (V) research on driving power supply
- Fast pace? high pressure? VR panoramic Inn brings you a comfortable life
- Intensive reading of thinking about markdown
- UE4 WebBrowser图表不能显示问题
- DO280OpenShift访问控制--加密和ConfigMap
- 人体改造 VS 数字化身
- 部门新来的00后真是卷王,工作没两年,跳槽到我们公司起薪18K都快接近我了
- Ott marketing is booming. How should businesses invest?
猜你喜欢

What are the advantages of VR panoramic production? Why is it favored?

JPA learning 1 - overview, JPA, JPA core annotations, JPA core objects

A small program written this week

One way 和two way ANOVA分析的区别是啥,以及如何使用SPSS或者prism进行统计分析

Svg+js keyboard control path

美国众议院议员:数字美元将支持美元作为全球储备货币

Time unified system

Im instant messaging development application keeping alive process anti kill

Collective example

【排行榜】Carla leaderboard 排行榜 运行与参与手把手教学
随机推荐
JDBC - database connection
Transition from digitalization to intelligent manufacturing
What are the advantages of VR panoramic production? Why is it favored?
Simple collation of Web cache
第三代电力电子半导体:SiC MOSFET学习笔记(五)驱动电源调研
D omit parameter name
Report on operation pattern and future prospect of global and Chinese propyl isovalerate industry from 2022 to 2028
在滴滴和字节跳动干了 5年软件测试,太真实…
Ten commandments of self-learning in machine learning
C程序设计专题 15-16年期末考试习题解答(上)
VR全景怎么赚钱?结合市场从两个方面客观分析下
【图数据库性能和场景测试利器LDBC SNB】系列一:数据生成器简介 & 应用于GES服务
中低速航空航天电子总线概述
部门新来的00后真是卷王,工作没两年,跳槽到我们公司起薪18K都快接近我了
JPA learning 2 - core annotation, annotation addition, deletion, modification and query, list query result return type, one to many, many to one, many to many
Analysis report on development trend and investment forecast of global and Chinese D-leucine industry from 2022 to 2028
走近Harvest Moon:Moonbeam DeFi狂欢会
Current situation analysis and development trend forecast report of global and Chinese acrylonitrile butadiene styrene industry from 2022 to 2028
Design and practice of vivo server monitoring architecture
Adding, deleting, modifying and checking in low build code
