Cryptography on the Growth Path of Programmers-Introduction to Cryptography

Terms you need to know before reading this article:

  1. Authorizer/Unauthorizer: The authorizer refers to the user who has obtained the permission to view the data, and the unauthorized person refers to the user who has not obtained the permission.
  2. Plaintext/Ciphertext: Plaintext refers to the unencrypted data content, and ciphertext refers to the encrypted data content
  3. CIA (not the CIA in cryptography, but the three elements of information security): C-Confidentiality Confidentiality I-Integrity Integrity A-Availability Availability Confidentiality: Data can only be accessed and processed by authorized persons Integrity: Guarantee data The integrity of the data will not be tampered with by third-party unauthorized persons or institutions
    Availability: ensure that the data can be accessed by authorized persons at any time
  4. Diffusion, confusion: Diffusion: Diffusion is to let each bit in the plaintext affect many bits in the ciphertext, or let each bit in the ciphertext be affected by many bits in the plaintext. The frequency of each letter in the ciphertext is closer to equal than that in the plaintext, and the frequency of double letters and multiple letters is also closer to equal, so as to prevent the key from being deciphered piece by piece.
    Confusion: Make the statistical relationship between the ciphertext and the key as complicated as possible, making it very difficult for unauthorized people to guess the key, that is to say, making known ciphertext and known plaintext attacks almost infeasible.
  5. Known ciphertext attack: The resource that the cryptanalyst can use is only one or more ciphertexts encrypted by the same key, which is the most unfavorable situation for the cryptanalyst. Known-plaintext attack: The cryptanalyst recovers the key based on some known plaintext-ciphertext pairs.
    Chosen plaintext attack: A cryptanalyst is able to choose a plaintext and obtain the corresponding ciphertext. This is a very favorable situation for the cryptanalyst.
    Chosen ciphertext attack: A cryptanalyst is able to choose a ciphertext and obtain the corresponding plaintext. It is also a very favorable situation for the cryptanalyst.

What is a password? What does encryption do?

The password is the result of encrypting the plaintext to prevent unauthorized persons from viewing, tampering, and forging the plaintext data.
Encryption can ensure the confidentiality, integrity and availability of information security, reduce the risk of tampering and forgery, and theoretically guarantee the security of data

History of Cryptography

Phase 1: Classical ciphers (? - the end of the 19th century)
appeared substitution ciphers (Substitution Cipher) and shift ciphers (Transposition Ciphet) and a combination of these two Substitution ciphers: According to the ciphertext substitution table, the conversion and shifting
of plaintext to ciphertext
Cipher: Each letter in plaintext moves a fixed length of position in the alphabet. For example, k (number of digits moved backwards) = 3, then a in the plaintext will become d, and b will become e. The last 3 digits of the alphabet correspond to the beginning abc. This kind of shift cipher is also called Caesar cipher

Phase 2: Modern ciphers (early 20th century – 1949)
The most classic during this period belongs to the story of the Turing machine invented by Turing and others to crack Enigma (Enigma). Germany, which was in World War II at that time, invented Enigma (Ingma) by some means—a machine for encrypting intelligence. After research, it was found that this machine has a major flaw, that is, if the same letter is continuously encrypted, it will not be encrypted into the same letter, and the letter will not be encrypted into itself. In other words, you can use the password table + ciphertext analysis to decipher. Using this loophole plus the analysis of the frequency of vocabulary (it is said that wetter (German "weather") was chosen, and then matched one by one to find the matching ciphertext, coupled with the analysis of other words, finally got a relatively relatively Reliable ciphertext substitution tables played an important role in World War II.

Phase 3: Modern ciphers (1949 to present)
Why choose 1949? Because the famous cryptographer Shannon published "Communication Theory of Secrecy Systems" in 1949, in this paper, he pioneered two basic principles of cryptographic system design: confusion and diffusion [see terminology for details]. And this paper brilliantly clarifies the scientific thinking about the analysis, evaluation and design of cryptographic systems. It became the beginning of modern cryptography.

What are the types of encryption algorithms?

It can be divided into block cipher and sequence cipher according to the length of data processed at one time:
block cipher:
diagram:
insert image description here

Features:

  1. A fixed length of information can be processed at a time,
  2. The key length does not have to be the same as the plaintext
    . Advantages:
  3. Good diffusivity, not easy to tamper
  4. Sensitive to modification
    Cons:
  5. Encryption and decryption are slow
    Common algorithms: DES, AES, 3DES
    sequence ciphers:
    diagram:
    insert image description here

Features:

  1. Only information of a certain fixed unit length can be processed at a time (such as one bit, one bit)
  2. The length of the key should be the same as that of the plaintext.
    Advantages:
    1. High encryption and decryption efficiency
    Disadvantages:
  3. The length of the key and the plaintext are the same, and the security performance depends on the length of the plaintext
  4. Easy to tamper
    Common algorithms: RC4, SEAL can be divided into symmetric encryption and asymmetric encryption
    according to the encryption and decryption methods Symmetric encryption: Features: encryption and decryption use the same key Encryption and decryption Disadvantage: Since the same key is used for encryption and decryption, the security of encryption and decryption is not high. Common algorithms: AES, DES Asymmetric encryption: Features: Encryption and decryption use different keys, divided into public key and private key, public key encryption, private key decryption Advantages: Encryption and decryption are relatively safe, suitable for encryption and decryption with a small amount of data Disadvantages: Encryption and decryption are less efficient. Common algorithms: RSA, DSA









Now generally used encryption algorithm model?

  1. SM2(Asymmetric) + SM4(Symmetric) + SM3(Summary)
  2. RSA(asymmetric) + AES(symmetric) + MD5(digest)

----------------------------------------Little tail-------- ------------------------------------
Newcomer to cryptography, please advise

Guess you like

Origin blog.csdn.net/qq_31236027/article/details/128003587