【区块链关键技术】-“密码学”

资讯 2024-06-25 阅读:67 评论:0
之前本人研究的东西大多偏向于智能合约和共识算法、跨链等一些知识,确实也是这俩比较值得研究一些,在此基础上区块链中的相关关键技术还有密码学相关知识和分布式存储相关的一些知识。Much of what I studied earlier was...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

之前本人研究的东西大多偏向于智能合约和共识算法、跨链等一些知识,确实也是这俩比较值得研究一些,在此基础上区块链中的相关关键技术还有密码学相关知识和分布式存储相关的一些知识。

Much of what I studied earlier was in favour of some knowledge, such as intellectual contracts and consensus algorithms, and cross-linkages, which are indeed more worthy of study, based on the key technologies involved in the chain of blocks, as well as cryptography-related knowledge and distributed storage of some of the relevant knowledge.

本期就结合着最近在忙的东西归纳了一下区块链密码学的整理,当然学东西都得学全套不是。废话不多说上干货。

This time, we've got a lot of stuff to do with block chain cryptography. Of course, we've got to learn the whole thing. We don't talk about dry stuff.

密码学在区块链中的应用归纳为3类:数字摘要算法、数字签名、加密算法。

The cryptography application in block chains is summarized into three categories: digital summary algorithms, digital signatures, encryption algorithms.

数字摘要(又称哈希、散列或杂凑)算法能将任意长度的二进制明文映射为较短的固定长度的二进制值,即生成摘要(又称哈希值)。数字摘要算法具有输入敏感、输出快速轻量、逆向困难的特性,在区块链中,可用于实现数据防篡改、链接区块、快速比对验证等功能。此外,数字摘要算法还应用在消息认证、数字签名及验签等场景中。目前主流的数字摘要算法包括SHA256、SM3等。

The numerical summary (also known as Hashi, hash or patches) algorithm

数字签名算法主要包括数字签名和签名验签两个具体操作,数字签名操作指签名者用私钥对信息原文进行处理生成数字签名值;签名验签操作指验证者利用签名者公开的公钥针对数字签名值和信息原文验证签名。在区块链中,数字签名算法用以确认数据单元的完整性、不可伪造性和不可否认性。常用的数字签名算法包括RSA、ECDSA、SM2等。

The digital signature algorithm consists mainly of two specific operations for digital signatures and signature verification, which means that the signatory processes the original message with a private key to generate a digital signature value; the signature verification operation means that the certifying officer authenticates the signature using the public key published by the signatory to verify the digital signature value and the original message. In the block chain, the digital signature algorithm is used to confirm the integrity, forgery and undeniable nature of the data module. Common digital signature algorithms include RSA, ECDSA, SM2.

根据加密密钥和解密密钥是否相同,加密算法可以分为对称加密算法和非对称加密算法。对称加密算法中两个密钥相同,并且加解密操作速度相对较快,一般用于普通数据的加密保护,主流的对称加密算法包括AES、SM4等。非对称加密算法的解密密钥是由解密者持有,而加密密钥是公开可见的,几乎无法从加密密钥推导出解密密钥,能够节约系统中密钥存储,一般用于对称密钥的封装保护和短数据加密,主流的非对称加密算法包括RSA、SM2等。在区块链中,非对称密钥算法可用于数字签名、地址生成、交易回溯和交易验证等。此外,在区块链网络系统中,密钥的

Depending on whether or not the encryption key is identical, encryption algorithm can be divided into

有效保护和受限使用对整个系统的安全亦有重要影响。在公有链场景,用户密钥通常通过区块链客户端程序来进行保存、管理和操作等。在联盟链或专有链场景,通常会有更复杂多层级的用户管理和密钥托管的需求,包括身份鉴别和权限管理等。

Effective protection and restricted use also have important implications for the security of the system as a whole. In public chain settings, user keys are usually saved, managed and operated through block chain client programs.

下面着重讲解哈希函数: 哈希是一种加密算法

The following highlights the Hashi function: Hashi is an encryption algorithm

1、哈希是一种加密算法

1, Hashi is an encryption algorithm

(1)哈希函数(Hash Function),又叫散列函数、散列算法。

(1) Hash Action, also known as hash function, hash algorithm.

哈希函数是一个公开函数,可以将任意长度的消息M映射成为一个长度较短且长度固定的值H(M),称H(M)为哈希值、散列值(Hash Value)、杂凑值或者消息摘要(Message Digest)。

The

(2)它是一种单向密码体制,即一个从明文到密文的不可逆映射,只有加密过程,没有解密过程。

(2) it is a one-way cryptographic system, an irreversible map from the express to the classified text, with only encryption and no decryption process.

(3)它的函数表达式为:h=H(m)

(3) Its function expression is: h=H(m)

函数说明:

Function description :

m:任意长度消息(不同算法实现,长度限制不同,有的哈希函数(SHA-3)不限制消息长度,有的限制(SHA-2),但即使有限制其长度也非常大,可以认为是任意长度消息)

m: Any length message (a different algorithm is achieved, different length limits, some Hashi function (SHA-3) does not limit the length of the message, some limits (SHA-2), but even if there are limits, they are very large and can be considered as arbitrary length messages)

H:哈希函数

H: Hashi function

h:固定长度的哈希值

h: fixed long Hashi value

无论输入是什么数字格式、文件有多大,输出都是固定长度的比特串。以比特币使用的Sha256算法为例,无论输入是什么数据文件,输出就是256bit

is a bit string with a fixed length, regardless of the number format in which it is entered or the size of the file. Take the Sha256 algorithm used in Bitcoin as an example, whatever the data file is entered, the output is 256bit.

2、Hash函数的特性

2, features of the Hash function

一个好的哈希函数必然具备:不定长输入固定长输出、抗碰撞性、不可逆性这三个特点。

(1)不定长度输入,固定长度输出

(1) Indefinite length input, fixed length output

所谓不定长度输入,固定长度输出,我们在前文中已经讲过了。就是不管输入的数据是多长,是多大,输出的数据长度、格式都是固定的。比如你选择sha256,那么你的输出就是256位。

(2)抗碰撞性

(2) Collision resistant

如果x不等于y,但是H(x)等于H(y),那么我们就说H()这个函数不具有抗碰撞性。反之,我们就认为其是具有抗碰撞性的。一个好的hash函数是一定要具有抗碰撞性的。

If x is not equal to y, but H(x) is equal to H(y), then let's say that the H() function is not collision resistant. Conversely, we think it is collision resistant. A good hash function must be collision resistant.

(3)不可逆性(单项性)

(3) Irreversibility (separate)

给定哈希函数H()和输入数据,可以很方便的求解出哈希值,但是给定哈希值和哈希函数几乎不能求解出输入数据是什么,这就是不可逆性,也叫做单向性。

The H() and input data given by

一个优秀的 hash 算法,将能实现:

(1)正向快速:给定明文和 hash 算法,在有限时间和有限资源内能计算出 hash 值。

(1) is fast-tracked: given specifications and hash algorithms, which allow the calculation of hash values within limited time and resources.

(2)逆向困难:给定(若干) hash 值,在有限时间内很难(基本不可能)逆推出明文。

(2) Reverse difficulties: a given (several) hash value is difficult (almost impossible) to reverse the explicit over a limited period of time.

(3)输入敏感:原始输入信息修改一点信息,产生的 hash 值看起来应该都有很大不同。

(3) input sensitivity: The original input information changes a little bit of information and the current value should appear to be very different.

(4)冲突避免:很难找到两段内容不同的明文,使得它们的 hash 值一致(发生冲突)。

(4) Conflict avoidance: It is very difficult to find two distinct paragraphs of the text that make their hash consistent (conflict).

3、哈希函数在区块链中的作用

3, the role of the Hashi function in the block chain

(1)快速验证。哈希函数在区块链中,生成各种数据的摘要,当比较两个数据是否相等时,只需要比较他们的摘要就可以了。例如,比较两个交易是否相等,只需要比较两者的hash值,快捷又方便。

(1) Quick verification. In the block chain, the Hashi function produces summaries of the various data, and when comparing the two data with the same, we just need to compare their summaries. For example, comparing the two transactions with the same, we need to compare the hash values and speed and convenience.

(2)防止篡改。传递一个数据,要保证它在传递过程中不被篡改,只需要同时传递它的摘要即可。收到数据的人将这个数据重新生成摘要,然后比较传递的摘要和生成的摘要是否相等,如果相等,则说明数据在传递过程中没有被篡改。

(2) prevents tampering. To transmit a data message, only a summary of the data is required to be transmitted at the same time in order to ensure that it is not tampered with.

(3)用于POW共识算法工作量证明。这个主要是在pow的共识算法中使用。详细说来,就是给定一定的数据,然后让你寻找其他的数据,合并起来计算出来的hash值小于某个值。比特币、目前的以太坊,都是使用的POW共识。

(3) for Pow consensus algorithm proof of workload. This is mainly used in pow consensus algorithms. Detailedly, you are given a certain amount of data, then you are asked to find other data, and the hash value calculated together is less than a certain value. Bitcoin, the current Ethercomb, is the Pow consensus.

POW简介 Proof of Work,工作证明。

Proof of Work, proof of service.

POW共识算法主要是通过计算难度值来决定谁来出块。POW的工作量是指方程式求解,谁先解出来,谁就有权利出块。方程式是通过前一个区块的哈希值和随机值nonce来计算下一个区块的哈希值,谁先找到nonce,谁就能最先计算出下一个区块的哈希值,这种方式之所以被称为计算难度值是因为方程式没有固定解法,只能不断的尝试,这种解方程式的方式称为哈希碰撞,是概率事件,碰撞的次数越多,方程式求解的难度就会越大。比特币就是采用POW共识算法

The Pow consensus algorithm determines who comes out of the block mainly by calculating difficulty values. The Pow workload refers to an equation that solves, and whoever solves it first has the right to come out of the block. The equation calculates the Hashi value of the next block through the Hashi and random nonce of the previous block. Whoever finds nonce first, the first one calculates the Hashi value of the next block, which is called the difficulty of calculating because the equation is not fixed, but only a continuous attempt. This solution is known as the Hashi collision, which is a probability event, the number of collisions, the greater the difficulty of the equation resolution. Bitcoin is the Pow consensus algorithm

winter

参考:https://blog.csdn.net/weixin_42694422/article/details/119853859

References: https://blog.csdn.net/weixin_42694422/article/details/119853859

CBD中国区块链技术和应用发展研究报告

CBD Study on Technology and Applied Development in Block Chains in China

区块链发展研究报告2020

Study on the development of the block chain 2020

(201

美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 区块链社区有哪些?区块链社区是什么?

    区块链社区有哪些?区块链社区是什么?
    展开全文...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 2018-5-31币圈简报

    2018-5-31币圈简报
    一、要闻资讯类I. KEY INFORMATION CATEGORY1、央视:数字货币在京揭牌成立!中国或为此突变!1. View: Digital currency is established in Kyoto! China or mutated for it!中国数字货币来了˂a href="https://mp.weixin.qq.com/s/69fxKCf8GKSCscS4lT8WCA" Target="_blank"rel="noformlow"" Chinese...
标签列表