cic-contracts/solidity/Digest.sol

24 lines
1.0 KiB
Solidity
Raw Normal View History

2023-03-26 13:04:31 +02:00
pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 1
interface IDigest {
// Returns the default digest encoding used by the contract instance.
function defaultDigestEncoding() external view returns (uint256 _encoding);
// Check if the given encoding has been implemented in the contract instance.
function haveDigestEncoding(uint256 _codec) external view returns(bool);
// Verify and encode the given digest for a specific hashing algorithm.
// Returns a zero-length byte array if digest is invalid.
// Must succeed if called with the defaultDigestEncoding and a valid digest.
function encodeDigest(bytes memory _data, uint256 _encoding) external view returns (bytes memory);
// Encodes the digest using the default digest encoding.
// Returns a zero-length byte array if digest is invalid.
// Must succeed with a valid digest.
function encodeDigest(bytes memory _data) external view returns (bytes memory);
}