区块链哈希函数的作用 区块链哈希函数的特点

哈希函数接受任意长度的输入字符串(数字,字母,媒体文件)并将其转换为固定长度。固定位长度可以变化(如32位或64位或128位或256位),具体取决于所使用的散列函数。固定长度输出称为散列。此哈希也是哈希算法的加密副产品。这如下所示。

区块链哈希函数

哈希算法具有某些独特的属性:

它产生一个唯一的输出(或哈希)。这是一个单向的功能。

在像比特币这样的加密货币的情况下,区块链在其共识机制中使用这种加密哈希函数的属性。加密散列是一定数量的数据的摘要或数字指纹。在加密散列函数中,事务被视为输入并通过散列算法运行,该算法提供固定大小的输出。

SHA-256

比特币的区块链使用SHA-256(安全哈希算法)哈希算法。2001年,SHA-256 Hashing算法由美国国家安全局(NSA)开发。

散列过程如何工作?

对于这个哈希函数,我们将使用由Anders Brownworth开发的程序。该程序可在以下链接中找到。

Anders Brownworth Hash计划:https://anders.com/blockchain/hash.html

区块链哈希函数

如果我们在数据部分中输入任何内容,您将看到在我们构建的每个字符中,您在哈希部分中都有一个等效的加密哈希。

例如:我们有数据类型部分:这是一个很棒的教程。

它会生成相应的Hash:

759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a 区块链哈希函数

现在,如果我们更改文本:“这是一个很棒的教程。”以“这是一个伟大的教程。”

你会发现相应的哈希:

4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018

在上面,你可以看到我们只将第一个字符大小写句子从大写“T”改为小“t”,它将改变整个哈希值。

注意:如果我们在数据部分再次写入相同的文本,它将始终提供相同的输出。这是因为您正在创建该特定数据量的消息摘要。

由于Hash函数是单向函数,因此无法从生成的哈希中获取整个文本。这与传统的加密功能(如加密)不同,您可以使用密钥加密某些内容,使用解密功能可以将邮件解密为原始格式。


The hash function accepts an input string of any length (numbers, letters, media files) and converts it to a fixed length. The fixed bit length can vary (like 32 bits or 64 bits or 128 bits or 256 bits) depending on the hash function used. The fixed length output is called a hash. This hash is also a cryptographic byproduct of the hashing algorithm. This is shown below.

The hashing algorithm has certain unique properties:

It produces a unique output (or hash). This is a one-way function.

In the case of cryptocurrencies like Bitcoin, the blockchain uses the properties of this cryptographic hash function in its consensus mechanism. A cryptographic hash is a digest or digital fingerprint of a certain amount of data. In a cryptographic hash function, a transaction is taken as input and run through a hashing algorithm that provides a fixed size output.

SHA-256

Bitcoin’s blockchain uses the SHA-256 (Secure Hash Algorithm) hashing algorithm. In 2001, the SHA-256 Hashing algorithm was developed by the US National Security Agency (NSA).

How does the hashing process work?

For this hash function we will use a program developed by Anders Brownworth. The program can be found at the link below.

Anders Brownworth Hash Scheme: https://anders.com/blockchain/hash.html

If we enter anything in the data section you will see that in the For every character, you have an equivalent cryptographic hash in the hash part.

For example: We have the data types section: This is a great tutorial.

It will generate the corresponding Hash:

759831720aa978c890b11f62ae49d2417f600f26aaa51b3291a8d21a4216582a

Now, if we change the text: "This is a great tutorial." to "This is a great tutorial." Tutorial."

You will find the corresponding hash:

4bc35380792eb7884df411ade1fa5fc3e82ab2da76f76dc83e1baecf48d60018

Above, you can see that we only changed the first character case of the sentence from a capital "T" to Small "t" and it will change the entire hash value.

Note: If we write the same text again in the data section, it will always give the same output. This is because you are creating a message digest for that specific amount of data.

Since the Hash function is a one-way function, the entire text cannot be obtained from the generated hash. This has nothing to do with traditionUnlike encryption features like Encrypt, where you use a key to encrypt something, the Decrypt feature lets you decrypt the message back to its original format.

本文来源: 网络 文章作者: 网络投稿
    下一篇

无论您是在寻找区块链开发工作还是只想了解幕后发生的事情,您都需要选择正确的语言来编写区块链。下面列出的六种语言是区块链开发领域中目前最热门的编程语言。1. C ++C ++是一种经得起考验的编程语言,