1a6a4ebfbb
Signed-off-by: AlienTornadosaurusHex <>
142 lines
9.3 KiB
HTML
142 lines
9.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<title>LCOV - lcov.info - v2/libraries/BytesUtils.sol</title>
|
|
<link rel="stylesheet" type="text/css" href="../../gcov.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
<tr><td class="title">LCOV - code coverage report</td></tr>
|
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
|
|
<tr>
|
|
<td width="100%">
|
|
<table cellpadding=1 border=0 width="100%">
|
|
<tr>
|
|
<td width="10%" class="headerItem">Current view:</td>
|
|
<td width="35%" class="headerValue"><a href="../../index.html">top level</a> - <a href="index.html">v2/libraries</a> - BytesUtils.sol<span style="font-size: 80%;"> (source / <a href="BytesUtils.sol.func-sort-c.html">functions</a>)</span></td>
|
|
<td width="5%"></td>
|
|
<td width="15%"></td>
|
|
<td width="10%" class="headerCovTableHead">Hit</td>
|
|
<td width="10%" class="headerCovTableHead">Total</td>
|
|
<td width="15%" class="headerCovTableHead">Coverage</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Test:</td>
|
|
<td class="headerValue">lcov.info</td>
|
|
<td></td>
|
|
<td class="headerItem">Lines:</td>
|
|
<td class="headerCovTableEntry">0</td>
|
|
<td class="headerCovTableEntry">13</td>
|
|
<td class="headerCovTableEntryLo">0.0 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Date:</td>
|
|
<td class="headerValue">2023-06-20 21:04:08</td>
|
|
<td></td>
|
|
<td class="headerItem">Functions:</td>
|
|
<td class="headerCovTableEntry">0</td>
|
|
<td class="headerCovTableEntry">3</td>
|
|
<td class="headerCovTableEntryLo">0.0 %</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="headerItem">Legend:</td>
|
|
<td class="headerValueLeg"> Lines:
|
|
<span class="coverLegendCov">hit</span>
|
|
<span class="coverLegendNoCov">not hit</span>
|
|
</td>
|
|
<td></td>
|
|
</tr>
|
|
<tr><td><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
</table>
|
|
|
|
<table cellpadding=0 cellspacing=0 border=0>
|
|
<tr>
|
|
<td><br></td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<pre class="sourceHeading"> Line data Source code</pre>
|
|
<pre class="source">
|
|
<a name="1"><span class="lineNum"> 1 </span> : // SPDX-License-Identifier: MIT</a>
|
|
<a name="2"><span class="lineNum"> 2 </span> : </a>
|
|
<a name="3"><span class="lineNum"> 3 </span> : pragma solidity ^0.6.12;</a>
|
|
<a name="4"><span class="lineNum"> 4 </span> : pragma experimental ABIEncoderV2;</a>
|
|
<a name="5"><span class="lineNum"> 5 </span> : </a>
|
|
<a name="6"><span class="lineNum"> 6 </span> : library BytesUtils {</a>
|
|
<a name="7"><span class="lineNum"> 7 </span> : /*</a>
|
|
<a name="8"><span class="lineNum"> 8 </span> : * @dev Returns the keccak-256 hash of a byte range.</a>
|
|
<a name="9"><span class="lineNum"> 9 </span> : * @param self The byte string to hash.</a>
|
|
<a name="10"><span class="lineNum"> 10 </span> : * @param offset The position to start hashing at.</a>
|
|
<a name="11"><span class="lineNum"> 11 </span> : * @param len The number of bytes to hash.</a>
|
|
<a name="12"><span class="lineNum"> 12 </span> : * @return The hash of the byte range.</a>
|
|
<a name="13"><span class="lineNum"> 13 </span> : */</a>
|
|
<a name="14"><span class="lineNum"> 14 </span> : function keccak(bytes memory self, uint256 offset, uint256 len) internal pure returns (bytes32 ret) {</a>
|
|
<a name="15"><span class="lineNum"> 15 </span><span class="lineNoCov"> 0 : require(offset + len <= self.length);</span></a>
|
|
<a name="16"><span class="lineNum"> 16 </span> : assembly {</a>
|
|
<a name="17"><span class="lineNum"> 17 </span><span class="lineNoCov"> 0 : ret := keccak256(add(add(self, 32), offset), len)</span></a>
|
|
<a name="18"><span class="lineNum"> 18 </span> : }</a>
|
|
<a name="19"><span class="lineNum"> 19 </span> : }</a>
|
|
<a name="20"><span class="lineNum"> 20 </span> : </a>
|
|
<a name="21"><span class="lineNum"> 21 </span> : /**</a>
|
|
<a name="22"><span class="lineNum"> 22 </span> : * @dev Returns the ENS namehash of a DNS-encoded name.</a>
|
|
<a name="23"><span class="lineNum"> 23 </span> : * @param self The DNS-encoded name to hash.</a>
|
|
<a name="24"><span class="lineNum"> 24 </span> : * @param offset The offset at which to start hashing.</a>
|
|
<a name="25"><span class="lineNum"> 25 </span> : * @return The namehash of the name.</a>
|
|
<a name="26"><span class="lineNum"> 26 </span> : */</a>
|
|
<a name="27"><span class="lineNum"> 27 </span> : function namehash(bytes memory self, uint256 offset) internal pure returns (bytes32) {</a>
|
|
<a name="28"><span class="lineNum"> 28 </span><span class="lineNoCov"> 0 : (bytes32 labelhash, uint256 newOffset) = readLabel(self, offset);</span></a>
|
|
<a name="29"><span class="lineNum"> 29 </span><span class="lineNoCov"> 0 : if (labelhash == bytes32(0)) {</span></a>
|
|
<a name="30"><span class="lineNum"> 30 </span><span class="lineNoCov"> 0 : require(offset == self.length - 1, "namehash: Junk at end of name");</span></a>
|
|
<a name="31"><span class="lineNum"> 31 </span><span class="lineNoCov"> 0 : return bytes32(0);</span></a>
|
|
<a name="32"><span class="lineNum"> 32 </span> : }</a>
|
|
<a name="33"><span class="lineNum"> 33 </span><span class="lineNoCov"> 0 : return keccak256(abi.encodePacked(namehash(self, newOffset), labelhash));</span></a>
|
|
<a name="34"><span class="lineNum"> 34 </span> : }</a>
|
|
<a name="35"><span class="lineNum"> 35 </span> : </a>
|
|
<a name="36"><span class="lineNum"> 36 </span> : /**</a>
|
|
<a name="37"><span class="lineNum"> 37 </span> : * @dev Returns the keccak-256 hash of a DNS-encoded label, and the offset to the start of the next label.</a>
|
|
<a name="38"><span class="lineNum"> 38 </span> : * @param self The byte string to read a label from.</a>
|
|
<a name="39"><span class="lineNum"> 39 </span> : * @param idx The index to read a label at.</a>
|
|
<a name="40"><span class="lineNum"> 40 </span> : * @return labelhash The hash of the label at the specified index, or 0 if it is the last label.</a>
|
|
<a name="41"><span class="lineNum"> 41 </span> : * @return newIdx The index of the start of the next label.</a>
|
|
<a name="42"><span class="lineNum"> 42 </span> : */</a>
|
|
<a name="43"><span class="lineNum"> 43 </span> : function readLabel(bytes memory self, uint256 idx)</a>
|
|
<a name="44"><span class="lineNum"> 44 </span> : internal</a>
|
|
<a name="45"><span class="lineNum"> 45 </span> : pure</a>
|
|
<a name="46"><span class="lineNum"> 46 </span> : returns (bytes32 labelhash, uint256 newIdx)</a>
|
|
<a name="47"><span class="lineNum"> 47 </span> : {</a>
|
|
<a name="48"><span class="lineNum"> 48 </span><span class="lineNoCov"> 0 : require(idx < self.length, "readLabel: Index out of bounds");</span></a>
|
|
<a name="49"><span class="lineNum"> 49 </span><span class="lineNoCov"> 0 : uint256 len = uint256(uint8(self[idx]));</span></a>
|
|
<a name="50"><span class="lineNum"> 50 </span><span class="lineNoCov"> 0 : if (len > 0) {</span></a>
|
|
<a name="51"><span class="lineNum"> 51 </span><span class="lineNoCov"> 0 : labelhash = keccak(self, idx + 1, len);</span></a>
|
|
<a name="52"><span class="lineNum"> 52 </span> : } else {</a>
|
|
<a name="53"><span class="lineNum"> 53 </span><span class="lineNoCov"> 0 : labelhash = bytes32(0);</span></a>
|
|
<a name="54"><span class="lineNum"> 54 </span> : }</a>
|
|
<a name="55"><span class="lineNum"> 55 </span><span class="lineNoCov"> 0 : newIdx = idx + len + 1;</span></a>
|
|
<a name="56"><span class="lineNum"> 56 </span> : }</a>
|
|
<a name="57"><span class="lineNum"> 57 </span> : }</a>
|
|
</pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
|
|
<table width="100%" border=0 cellspacing=0 cellpadding=0>
|
|
<tr><td class="ruler"><img src="../../glass.png" width=3 height=3 alt=""></td></tr>
|
|
<tr><td class="versionInfo">Generated by: <a href="https://github.com/linux-test-project/lcov" target="_parent">LCOV version 1.16</a></td></tr>
|
|
</table>
|
|
<br>
|
|
|
|
</body>
|
|
</html>
|