本文小编为大家详细介绍“区块链常用加密方法的原理是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“区块链常用加密方法的原理是什么”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。
原理:加密和解密数据使用同一个密钥,适合对大量数据进行加解密
Rationale: Encryption and declassification data use the same key and are suitable for decrypting large amounts of data
安全性:关键是密钥的保存方式,加密或是解密的任何一方泄漏密钥,都会导致信息泄漏
Security : The key is saved, the key is leaked by either encrypted or decrypted
代表算法:DES、3DES、Blowfish、IDEA、RC4、RC5、RC6、AES等
对称密码常用的数学运算:
symmetrical algorithms commonly used for passwords:
**移位和循环移位 **
**Modition and circulation
移位就是将一段数码按照规定的位数整体性地左移或右移。循环右移就是当右移时,把数码的最后的位移到数码的最前头,循环左移正相反。例如,对十进制数码12345678循环右移1位(十进制位)的结果为81234567,而循环左移1位的结果则为23456781。
The move is to move a number to the left or to the right as a whole according to the prescribed number of digits. The right move in the circle is to move the last position of the number to the front of the number when it moves right, and the left move in the reverse direction. For example, the right move in the decimal number of 12345678 is 81234567, while the left move in the circle is 23456781.
**置换 **
**Replace & nbsp; & nbsp;**
就是将数码中的某一位的值根据置换表的规定,用另一位代替。它不像移位操作那样整齐有序,看上去杂乱无章。这正是加密所需,被经常应用。
That's to replace a value in a number with another, based on the replacement table. It's not as neat as the move, it looks messy. That's what encryption requires, and it's often applied.
**扩展 **
**Extensions & nbsp; & nbsp;**
就是将一段数码扩展成比原来位数更长的数码。扩展方法有多种,例如,可以用置换的方法,以扩展置换表来规定扩展后的数码每一位的替代值。
It is to expand a number into a number that is longer than the original number. There are a number of ways to expand it, for example, by replacing it with a table that defines the replacement value for each of the expanded numbers.
**压缩 **
** Compressed & nbsp; & nbsp;**
就是将一段数码压缩成比原来位数更短的数码。压缩方法有多种,例如,也可以用置换的方法,以表来规定压缩后的数码每一位的替代值。
It is to compress a number into a number that is shorter than the original number. There are a number of methods of compression, for example, replacement methods that can be used to define the replacement value of each compressed number in a table.
**异或 **
** Different or & nbsp; & nbsp;**
这是一种二进制布尔代数运算。异或的数学符号为⊕ ,它的运算法则如下:
This is a binary Boolean Algebra operation. A different or mathematical symbol is a titanium, and its algorithm is as follows:
1⊕1=0 0⊕0=0 1⊕0=1 0⊕1=1
也可以简单地理解为,参与异或运算的两数位如相等,则结果为0,不等则为1。
It can also simply be understood that if the two digits involved are equal, the result will be zero, which will vary from one.
**迭代 **
**External & nbsp; & nbsp;**
迭代就是多次重复相同的运算,这在密码算法中经常使用,以使得形成的密文更加难以破解。
Interlacing is the repeated repetition of the same calculations, which is often used in cryptographic algorithms to make it more difficult to decipher messages.
原理:
Rationale:
非对称加密算法需要两个密钥:公开密钥(publickey)和私有密钥(privatekey)。公开密钥与私有密钥是一对,如果用公开密钥对数据进行加密,只有用对应的私有密钥才能解密;如果用私有密钥对数据进行加密,那么只有用对应的公开密钥才能解密
Asymmetric cryptography requires two keys: a public key (publickey) and a private key (privatekey). A public key is a pair of private keys, and if a public key is used to encrypt data, only the corresponding private key is used to decrypt it; if a private key is used to encrypt the data, then only the corresponding public key is used to decrypt it.
**安全性:**公钥可以被任何人知道,但是私钥被泄漏就会导致信息泄漏
**Safety: **Pkeys can be known by anyone, but leaking a private key leads to a leak of information.
应用场景:
Application scene:
数字签名,私钥拥有者对信息进行加密,接受者使用公钥解密成功,就可以确定发送者的身份
A digital signature, a private key owner encrypts the information, and the recipient uses a public key to decrypt the sender's identity.
密钥长度:
key length:
通常是1024,2048等。密钥长度增长一倍,公钥操作所需时间增加约4倍,私钥操作所需时间增加约8倍,公私钥生成时间约增长16倍
Usually 1024, 2048, etc.. The key length has doubled, the time it takes to operate a public key has increased about fourfold, the time it takes to operate a private key has increased about eightfold, and the time it takes to generate a public key is about 16 times.
加密的明文长度:
Encryption length:
加密的明文长度不能超过RSA密钥的长度减去11byte,比如密钥长度是1024位的,1024位=1024bit=128byte,128-11=117byte,所以明文长度不能超过117byte,如果长度超过该值将会抛出异常。加密后密文的长度为密钥的长度,如密钥长度为1024bit(128Byte),最后生成的密文固定为 1024bit(128Byte)
The explicit length of encryption cannot exceed the length of RSA keys minus 11byte, e.g. the length of the key is 1024, 1024 = 1024bit = 128byte, 128-11 = 117byte, so the explicit length cannot exceed 117 byte, and if the length exceeds that value, it will be abnormal. The length of the message after encryption is the length of the key, e.g. the length of the key is 1024bit (128Byte), and the resulting message is fixed at 1024bit (128Byte).
**代表算法:**DES、3DES、Blowfish、IDEA、RC4、RC5、RC6、AES等
** Representing algorithms: **DES, 3DES, Blowfish, IDA, RC4, RC5, RC6, AES, etc.
原理:
Rationale:
采用某种散列函数,输入不同长度的明文,得到相同的长度的密文,明文的微小变化都能引起密文的巨大变化。其实哈希散列算法不算是真正的加密,而是生成对应明文的指纹信息,用来校验数据的完整性。
Using some kind of hash function, you enter a specific text for different lengths, you get a code for the same length, and a simple change in the code can cause a huge change in the code. In fact, the Hashish algorithm is not really encrypted, but rather generates the corresponding print information, which is used to verify the integrity of the data.
**安全性:**不能通过密文反推明文,通常作为数据的完整性校验
**Safety: ** Can't be inverted through classified text, usually as a data integrity check
**应用场景1:**生成信息摘要,验证信息的完整性
**Application scene 1: ** Generate information summaries to validate information integrity
**应用场景2:**不用明文存储用户密码,比如使用md5(md5(用户密码)+salt)来存储密码和验证密码,防止攻击者用彩虹表攻击
**Application scene 2:** No explicit storage of user passwords, such as md5(md5(user password)+salt) to store passwords and authenticate passwords to prevent attackers from using rainbow forms
**代表算法:**MD2、MD4、MD5、PANAMA、SHA-0、SHA-1、SHA-256、SHA-512等
** Representing algorithms: **MD2, MD4, MD5, PANAMA, SHA-0, SHA-1, SHA-256, SHA-512, etc.
读到这里,这篇“区块链常用加密方法的原理是什么”文章已经介绍完毕,想要掌握这篇文章的知识点还需要大家自己动手实践使用过才能领会,如果想了解更多相关内容的文章,欢迎关注亿速云行业资讯频道。
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论