cic-contracts/solidity/MultiHash.sol
2023-03-26 12:04:31 +01:00

25 lines
714 B
Solidity

pragma solidity >=0.6.12;
// Author: Louis Holbrook <dev@holbrook.no> 0826EDA1702D1E87C6E2875121D2E7BB88C2A746
// SPDX-License-Identifier: AGPL-3.0-or-later
// File-version: 2
interface IMultiHash {
// Represents a multicodec item.
struct MultiHash {
uint8 l;
uint8 codecRLength;
uint8 prefixRLength;
bytes16 prefix;
bytes8 codec;
}
// All registered multicodecs
function digestCodec(uint256 _codec) external view returns(MultiHash memory);
function haveDigestEncoding(uint256 _codec) external view returns(bool);
// Generate a multihash from the given digest and current selected multicodec
function encodeDigest(uint256 _codec, bytes memory _digest) external view returns(bytes memory);
}