Internet Technologies 简明教程

Data Encryption

Introduction

加密是一种安全方法,其中信息被编码,以便只有授权用户可以读取。它使用加密算法来生成只能在解密后才能读取的密文。

Encryption is a security method in which information is encoded in such a way that only authorized user can read it. It uses encryption algorithm to generate ciphertext that can only be read if decrypted.

Types of Encryption

以下列出了两种类型的加密方案:

There are two types of encryptions schemes as listed below:

  1. Symmetric Key encryption

  2. Public Key encryption

Symmetric key encryption 算法对密文的加密和解密使用相同的加密密钥。

Symmetric key encryption algorithm uses same cryptographic keys for both encryption and decryption of cipher text.

internet symmetric key cryptography

Public key encryption 算法使用密钥对,其中一个密钥是密钥,另一个密钥是公钥。这两个密钥在数学上是相互关联的。

Public key encryption algorithm uses pair of keys, one of which is a secret key and one of which is public. These two keys are mathematically linked with each other.

internet public key cryptography

Hashing

在安全性方面,哈希是一种用于加密数据并生成不可预测哈希值的技术。它是一个哈希函数,它生成哈希代码,有助于保护传输数据的安全性,防止未经授权的用户访问。

In terms of security, hashing is a technique used to encrypt data and generate unpredictable hash values. It is the hash function that generates the hash code, which helps to protect the security of transmission from unauthorized users.

Hash function algorithms

Hashing algorithm 提供了一种方法来验证接收到的消息与发送的消息相同。它可以将纯文本消息作为输入,然后根据该消息计算出一个值。

Hashing algorithm provides a way to verify that the message received is the same as the message sent. It can take a plain text message as input and then computes a value based on that message.

Key Points

Key Points

  1. The length of computed value is much shorter than the original message.

  2. It is possible that different plain text messages could generate the same value.

在这里,我们将讨论一种哈希算法示例,我们将乘以消息中的 a、e、h 的数量,然后将 o 的数量加到这个值中。

Here we will discuss a sample hashing algorithm in which we will multiply the number of a’s, e’s and h’s in the message and will then add the number of o’s to this value.

例如,消息是“保险箱的组合是二,七,三十五”。使用我们简单的哈希算法,此消息的哈希如下所示:

For example, the message is “ the combination to the safe is two, seven, thirty-five”. The hash of this message, using our simple hashing algorithm is as follows:

此消息的哈希已发送给 John 和密文。在他解密消息后,他会使用约定的哈希算法计算其哈希值。如果 Bob 发送的哈希值与解密消息的哈希值不匹配,John 将知道消息已被更改。

The hash of this message is sent to John with cipher text. After he decrypts the message, he computes its hash value using the agreed upon hashing algorithm. If the hash value sent by Bob doesn’t match the hash value of decrypted message, John will know that the message has been altered.

例如,John 收到哈希值 17,并解密了 Bob 发送的消息,消息是“有人跟踪你,走小路,快!”

For example, John received a hash value of 17 and decrypted a message Bob has sent as “You are being followed, use backroads, hurry”

他可以得出消息已被更改的结论,这是因为他收到的消息的哈希值是:

He could conclude the message had been altered, this is because the hash value of the message he received is:

这与 Bob 发送的值 17 不同。

This is different from then value 17 that Bob sent.