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
- Three types of hash value (MD5 SHA-2 (SHA256 / SHA512)) of file information are generated and registered by block chain.
- Hash value calculation is performed outside the block chain.
- Information that can identify a file is not registered in the block chain. The registered information can not be deleted.
- Three hash values of file information (MD5 SHA-2 (SHA256 / SHA512))
- File ID generated by combining three types of hash values
- Registered user's ETH address
- Time stamp when the information was taken into the blockchain
As file information is recorded, there is no concern such as falsification of the record
- File registrant needs to pay GAS
- Are registered files still present in the future? Can not be managed (do not manage)
argument
- string
_md5
: MD5 hash value - string
_sha256
: SHA256 hash value - string
_sha512
: SHA512 hash value
Return value
- byte32: Calculated file ID
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
- string
_md5
: MD5 hash value - string
_sha256
: SHA256 hash value - string
_sha512
: SHA512 hash value
function
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
- string
fileId
: File ID
Return value
- bool: true: Registered false: Not registered
function
function isExist(bytes32 fileId) public view returns (bool);
The file ID is acquired by the above-mentioned "calculation of file ID".
argument
- string
fileId
: File ID
Return value
- bytes32
_fileId
File ID - bytes
_md5
: MD5 hash value - bytes
_sha256
: SHA256 hash value - bytes
_sha512
: SHA512 hash value - address
_registrant
: Registrant EOA - uint _
timestamp
: Time stamp of captured block - uint
_isExist
: Always1
if registered
function
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.