Implementation to manage hash value of file data in block chain
Read this in other languages: English, 日本語.
Use a smart contract to manage the hash value of data of a file in a block chain, and implement a mechanism to confirm that the file certainly existed at a certain point in time
As file information is recorded, there is no concern such as falsification of the record
argument
_md5
: MD5 hash value_sha256
: SHA256 hash value_sha512
: SHA512 hash valueReturn value
return keccak256(abi.encodePacked(bytes(_md5), bytes(_sha256), bytes(_sha512)));
function
function getFileId(string memory _md5, string memory _sha256, string memory _sha512) public pure returns (bytes32);
argument
_md5
: MD5 hash value_sha256
: SHA256 hash value_sha512
: SHA512 hash valuefunction
function registerFileHash(string memory _md5, string memory _sha256, string memory _sha512);
Do not implement the erasure process
The file ID is acquired by the above-mentioned “calculation of file ID”.
argument
fileId
: File IDReturn value
function
function isExist(bytes32 fileId) public view returns (bool);
The file ID is acquired by the above-mentioned “calculation of file ID”.
argument
fileId
: File IDReturn value
_fileId
File ID_md5
: MD5 hash value_sha256
: SHA256 hash value_sha512
: SHA512 hash value_registrant
: Registrant EOAtimestamp
: Time stamp of captured block_isExist
: Always 1
if registeredfunction
function getFileIdentity(bytes32 fileId) public view
returns (bytes32 _fileId, bytes memory _md5, bytes memory _sha256, bytes memory _sha512, address _registrant, uint _timestamp, uint _isExist)
Implementation will be released on GitHub.