更改块哈希的默认哈希函数
Change default hash function for block hashing
我对 HF 很陌生,我应该为一个大学项目研究这个平台。分配的第一件事是了解 Fabric 源,特别是找到块创建完成的位置以及可以更改用于块创建的默认哈希函数的方式。
我找到了一些文件,其中可能是我感兴趣的部分,但我是该平台的新手,我真的不知道从哪里获得此类信息。
我找到了这个:
- https://github.com/hyperledger/fabric/blob/release-1.2/common/ledger/blockledger/util.go
CreateNewBlock函数
- https://github.com/hyperledger/fabric/blob/release-1.2/protos/common/block.go
有什么帮助吗?谢谢。
根据文档,目前 SHA256 是唯一一种有效的算法。它在某些地方被硬编码了。
但是,您可以做一些实验,以下是您可能想要研究的一些配置位置 -
peer and orderer nodes, and the channel configuration Hashing Algorithm part 的 BCCSP 配置。
BCCSP 配置区块链加密服务提供商。
BCCSP:
# Default specifies the preferred blockchain crypto service provider
# to use. If the preferred provider is not available, the software
# based provider ("SW") will be used.
# Valid providers are:
# - SW: a software based crypto provider
# - PKCS11: a CA hardware security module crypto provider.
Default: SW
# SW configures the software based blockchain crypto provider.
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of key store. If this is unset, a location will be
# chosen using: 'LocalMSPDir'/keystore
FileKeyStore:
KeyStore:
我找到了解决方案。
这样做是可能的,可以通过替换
中的散列函数来完成
protos/common/block.go
文件,正如我在 post 中所说的那样 ;)
我对 HF 很陌生,我应该为一个大学项目研究这个平台。分配的第一件事是了解 Fabric 源,特别是找到块创建完成的位置以及可以更改用于块创建的默认哈希函数的方式。
我找到了一些文件,其中可能是我感兴趣的部分,但我是该平台的新手,我真的不知道从哪里获得此类信息。
我找到了这个:
- https://github.com/hyperledger/fabric/blob/release-1.2/common/ledger/blockledger/util.go CreateNewBlock函数
- https://github.com/hyperledger/fabric/blob/release-1.2/protos/common/block.go
有什么帮助吗?谢谢。
根据文档,目前 SHA256 是唯一一种有效的算法。它在某些地方被硬编码了。
但是,您可以做一些实验,以下是您可能想要研究的一些配置位置 - peer and orderer nodes, and the channel configuration Hashing Algorithm part 的 BCCSP 配置。
BCCSP 配置区块链加密服务提供商。
BCCSP:
# Default specifies the preferred blockchain crypto service provider
# to use. If the preferred provider is not available, the software
# based provider ("SW") will be used.
# Valid providers are:
# - SW: a software based crypto provider
# - PKCS11: a CA hardware security module crypto provider.
Default: SW
# SW configures the software based blockchain crypto provider.
SW:
# TODO: The default Hash and Security level needs refactoring to be
# fully configurable. Changing these defaults requires coordination
# SHA2 is hardcoded in several places, not only BCCSP
Hash: SHA2
Security: 256
# Location of key store. If this is unset, a location will be
# chosen using: 'LocalMSPDir'/keystore
FileKeyStore:
KeyStore:
我找到了解决方案。
这样做是可能的,可以通过替换
中的散列函数来完成protos/common/block.go
文件,正如我在 post 中所说的那样 ;)