加密货币公钥和私钥 区块链中公钥和私钥的区别

了解对称加密与非对称加密后,接下来就来介绍,加密货币的私钥、公钥和地址是什么,三者又是如何产生的。以下就以比特币的协议来介绍地址、公钥、私钥,流程较为复杂,我会简化某些流程,方便大家阅读。

私钥(private key )

私钥是一段由电脑随机产生的乱数,包含了大约五十个数字和大小写字母,没有固定的逻辑和规则。私钥与公钥是成对产生的,世界上只会有一组,不会重复,在加密货币的世界里,公钥会散布在网路上,但「私钥」只能本人持有,因此「私钥」就代表资产的所有权,谁拥有「私钥」谁就拥有该钱包地址中的使用权,所以千万要好好保管你的「私钥」,不要随便交付任何人,也不要将它记在任何可能被窃取的电脑或云端硬碟。

公钥( public key )

比特币的公钥是透过称为「椭圆曲线加密」的演算法(也就是上图的SECP256K1)对私钥进行加密后所产生的一组乱数。「椭圆曲线密码学」的算法为不可逆,也就是说,即使「公钥」暴露,也不会影响「私钥」的安全性,因为没办法藉由「公钥」推算出「私钥」。这点非常重要,可说整个加密货币密码学的匿名和安全都是架构于这个基础之上。

地址( address )

比特币地址是根据「公钥」经过两次哈希函数(上图的SHA256)转换为公钥哈希,这个过程同样是不可逆的,之后再将公钥哈希经过编码推算得到地址。地址的功能是接收比特币,某个地址收到比特币后,只有拥有该地址对应「私钥」的人才能使用它。

如果读到这,你脑袋一片混乱,那就看完这张图,然后记住:

通过私钥可以得到计算过程中所有的值。(所以千万要保管好)私钥锁起来的,公钥可以解开。公钥锁的,私钥可以解开。只有『公钥哈希』和『钱包地址』可以通过互逆运算进行转换,所以它们是等价的。之所以要进行编码是为了可读性。


After understanding symmetric encryption and asymmetric encryption, let’s introduce what the private key, public key and address of cryptocurrency are, and how they are generated. The following uses the Bitcoin protocol to introduce addresses, public keys, and private keys. The process is relatively complicated. I will simplify some processes to make it easier for everyone to read.

Private key (private key)

The private key is a random number randomly generated by the computer. It contains about fifty numbers and uppercase and lowercase letters. There is no fixed logic and rules. Private keys and public keys are generated in pairs. There will only be one set in the world and will not be repeated. In the world of cryptocurrency, public keys will be scattered on the Internet, but the "private key" can only be held by the person. Therefore, " "Private Key" represents the ownership of the asset. Whoever owns the "Private Key" has the right to use the wallet address, so be sure to keep your "Private Key" well, do not give it to anyone casually, and do not remember it. on any computer or cloud drive that may have been stolen.

Public key (public key)

Bitcoin’s public key is a set of private keys generated by encrypting the private key through an algorithm called “elliptic curve encryption” (that is, SECP256K1 in the picture above) Random numbers. The algorithm of "elliptic curve cryptography" is irreversible, which means that even if the "public key" is exposed, it will not affect the security of the "private key" because there is no way to deduce the "private key" from the "public key". This is very important. It can be said that the anonymity and security of the entire cryptocurrency cryptography are based on this foundation.

Address (address)

The Bitcoin address is converted into a public key hash based on the "public key" through two hash functions (SHA256 in the picture above). This process is also irreversible, and then the public key is hashed. The key hash is encoded to derive the address. The function of the address is to receive Bitcoin. After an address receives Bitcoin, only the person who owns the "private key" corresponding to the address can use it.

If your mind is confused after reading this, then read this picture and remember:

All values ​​in the calculation process can be obtained through the private key. (So ​​be sure to keep it safe) If the private key is locked, the public key can unlock it. Locked with the public key, unlocked with the private key. Only "public key hash" and "wallet address" can be converted through reciprocal operations, so they are equivalent. The reason for encoding is for readability.

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