BytesLib

Git Source

Author: Gonçalo Sá [email protected]

Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.

Functions

concat

function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory);

concatStorage

function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal;

slice

function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory);

toAddress

function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address);

toUint8

function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8);

toUint16

function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16);

toUint32

function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32);

toUint64

function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64);

toUint96

function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96);

toUint128

function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128);

toUint256

function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256);

toBytes32

function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32);

equal

function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool);

equalStorage

function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool);

Errors

BytesLib__Overflow

error BytesLib__Overflow();

BytesLib__OutOfBounds

error BytesLib__OutOfBounds();