From 86d232d14036249dd2609957dee335be20d261b5 Mon Sep 17 00:00:00 2001 From: Robert Martin-Legene <robert@nic.ar> Date: Tue, 31 Jul 2018 11:04:51 -0300 Subject: [PATCH] Deleting obsolete TimestampDocument --- src/contract.TimestampDocument.sol | 50 ------------------------------ 1 file changed, 50 deletions(-) delete mode 100644 src/contract.TimestampDocument.sol diff --git a/src/contract.TimestampDocument.sol b/src/contract.TimestampDocument.sol deleted file mode 100644 index 21d6bb7..0000000 --- a/src/contract.TimestampDocument.sol +++ /dev/null @@ -1,50 +0,0 @@ -// 20180612 Robert Martin-Legene <robert@nic.ar> -// It can be difficult to feed large binary "documents" into this -// routine, so it should be changed to accept just the checksum, -// so we'll call this v0.1 - -pragma solidity ^0.4.24; - -contract TimestampDocument { - - // This mapping is almost an "associative array" - mapping (bytes32 => uint) private hashes; - - // Public functions - - // - // Calculate and store the hash for a document - // - function storeDocument( string document ) public { - bytes32 hash = sha256(abi.encodePacked(document)); - storeHash( hash ); - } - - // - // Returns the block number a hash was first seen in. - // zero (0) means not found. - // - function checkDocument( string document ) public view returns (uint) { - return getBlock( sha256(abi.encodePacked(document)) ); - } - - // Private functions - - // - // Stores the hash of the document in the mapping - // if we have not seen the hash before. - // - function storeHash( bytes32 hash ) private { - if ( hashes[hash] == 0 ) { - hashes[hash] = block.number; - } - } - - // - // Returns the block number in which the hash was first seen, - // or zero (0) if never seen. - // - function getBlock( bytes32 hash ) private view returns (uint) { - return hashes[hash]; - } -} -- GitLab