<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Conver to Hexadecimal code to bit value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699674#M237512</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I would like to convert my hexadecimal code to a bit value based on this calculation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hex code - 0002&lt;BR /&gt;&lt;BR /&gt;Seperate 2 bytes each&amp;nbsp; 00/02&lt;BR /&gt;&lt;BR /&gt;2 Byte bitmask&lt;BR /&gt;Byte 0: HEX = 00 - 0000 0000&lt;BR /&gt;Byte 1: HEX = 02 - 0000 0010&lt;BR /&gt;&lt;BR /&gt;Byte 1 Byte0 - 0000 0010 0000 0000&lt;BR /&gt;&lt;BR /&gt;calculate the non zero th position values from right side&lt;BR /&gt;&lt;BR /&gt;Byte combination&amp;nbsp; -&amp;nbsp;0000 0010 0000 0000&lt;BR /&gt;Position -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 8765&amp;nbsp; 4321&lt;BR /&gt;&lt;BR /&gt;At position 10, we got 1 while counting from right side. so the bit value is 9.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I need to calculate this in splunk, where the HEX_Code is the value from the lookup.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;BR /&gt;Happy Splunking!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2024 18:35:41 GMT</pubDate>
    <dc:creator>smanojkumar</dc:creator>
    <dc:date>2024-09-20T18:35:41Z</dc:date>
    <item>
      <title>Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699674#M237512</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I would like to convert my hexadecimal code to a bit value based on this calculation.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Hex code - 0002&lt;BR /&gt;&lt;BR /&gt;Seperate 2 bytes each&amp;nbsp; 00/02&lt;BR /&gt;&lt;BR /&gt;2 Byte bitmask&lt;BR /&gt;Byte 0: HEX = 00 - 0000 0000&lt;BR /&gt;Byte 1: HEX = 02 - 0000 0010&lt;BR /&gt;&lt;BR /&gt;Byte 1 Byte0 - 0000 0010 0000 0000&lt;BR /&gt;&lt;BR /&gt;calculate the non zero th position values from right side&lt;BR /&gt;&lt;BR /&gt;Byte combination&amp;nbsp; -&amp;nbsp;0000 0010 0000 0000&lt;BR /&gt;Position -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 9 8765&amp;nbsp; 4321&lt;BR /&gt;&lt;BR /&gt;At position 10, we got 1 while counting from right side. so the bit value is 9.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I need to calculate this in splunk, where the HEX_Code is the value from the lookup.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;BR /&gt;Happy Splunking!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:35:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699674#M237512</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-20T18:35:41Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699690#M237513</link>
      <description>&lt;P&gt;It is not clear exactly what you are trying to do - is the hex code to be treated as if it is least significant byte first (left-most) and most significant byte second, but the bits in the byte are to be treated as most significant bit first (left-mode). Is that right?&lt;/P&gt;&lt;P&gt;Do you just want to know the bit position of the least significant bit?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 11:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699690#M237513</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-20T11:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699697#M237516</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="bit1,bit2
0000,0002
000f,0088
00af,00de
00bd,003c"
| fields bit1 bit2
| eval bit1ASnumber=tonumber(bit1,16), bit2ASnumber=tonumber(bit2,16)
| eval bit1ASbinary=tostring(bit1ASnumber,"binary"), bit2ASbinary=tostring(bit2ASnumber,"binary")
| table bit1 bit2 bit*ASnum* bit*ASbin*&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="49.4062px" height="25px"&gt;bit1&lt;/TD&gt;&lt;TD width="49.4062px" height="25px"&gt;bit2&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;bit1ASnumber&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;bit2ASnumber&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;bit1ASbinary&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;bit2ASbinary&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="49.4062px" height="25px"&gt;0000&lt;/TD&gt;&lt;TD width="49.4062px" height="25px"&gt;0002&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="49.4062px" height="25px"&gt;000f&lt;/TD&gt;&lt;TD width="49.4062px" height="25px"&gt;0088&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;15&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;136&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;1111&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;10001000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="49.4062px" height="25px"&gt;00af&lt;/TD&gt;&lt;TD width="49.4062px" height="25px"&gt;00de&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;175&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;222&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;10101111&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;11011110&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="49.4062px" height="25px"&gt;00bd&lt;/TD&gt;&lt;TD width="49.4062px" height="25px"&gt;003c&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;189&lt;/TD&gt;&lt;TD width="115.906px" height="25px"&gt;60&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;10111101&lt;/TD&gt;&lt;TD width="87.8125px" height="25px"&gt;111100&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Ok I can get you as far as converting to binary but the results of the binary do not include leading 0's to always make an 8 character string/number.&amp;nbsp; Since your example had 4 characters for the hex code those values are treated as string so first convert to a number before converting to binary as attempting to go straight will fail when your source as a mix of alphanumeric characters.&lt;/P&gt;&lt;P&gt;Obviously without the leading zeros when you concatenate the two values as strings you will lose some positions you need to count.&amp;nbsp; Also I didn't bother with sorting out the count how many zero's right of the last occurring 1 but essentially that's what comes after inserting your leading zero's&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 13:55:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699697#M237516</guid>
      <dc:creator>dural_yyz</dc:creator>
      <dc:date>2024-09-20T13:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699702#M237517</link>
      <description>&lt;P&gt;OK. This is confusing. You have four hexadecimal digits but they're little-endian so the resulting bit order (not byte, mind you; you're happily using the same word for both bits and bytes). But what the calculation should be based on? What do you want to achieve?&lt;/P&gt;&lt;P&gt;You showed only one example which is a power of 2 so it gives you just one set bit in your whole 16-bit sequence. But what if you had 0x63 0x3A?&lt;/P&gt;&lt;P&gt;0x63 is 01100011, 0x3A is 00111010&lt;/P&gt;&lt;P&gt;As this is little-endian, the resulting bit-stream would be&lt;/P&gt;&lt;P&gt;00111010 01100011&lt;/P&gt;&lt;P&gt;And what now?&lt;/P&gt;&lt;P&gt;You want the position of first non-zero bit from the right?&lt;/P&gt;&lt;P&gt;And what does it have to do with "lookup"?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 14:54:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699702#M237517</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-20T14:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699712#M237518</link>
      <description>&lt;P class="lia-align-left"&gt;Another example&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hex code - 00200100&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seperate 2 bytes each&amp;nbsp; 00/20/01/00&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4 Byte bitmask&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 0: HEX = 00 -&amp;nbsp;&amp;nbsp;0000&amp;nbsp;0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 1: HEX = 20 - 0010&amp;nbsp;0000&lt;BR /&gt;Byte 2: HEX = 01 - 0000 0001&lt;BR /&gt;Byte 3: HEX = 00 - 0000&amp;nbsp;0000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 3 Byte 2 Byte1 Byte 0 - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;calculate the non zero th position values from right side&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte combination&amp;nbsp; - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Position -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...9 8765&amp;nbsp; 4321&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At position 14 and 17, we got 1 while counting from right side. so the bit value is 13 and 16.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699712#M237518</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-20T18:35:16Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699713#M237519</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;Thanks for your time!&lt;BR /&gt;&lt;BR /&gt;Here is an another example&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;Another example&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hex code - 00200100&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seperate 2 bytes each&amp;nbsp; 00/20/01/00&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4 Byte bitmask&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 0: HEX = 00 -&amp;nbsp;&amp;nbsp;0000&amp;nbsp;0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 1: HEX = 20 - 0010&amp;nbsp;0000&lt;BR /&gt;Byte 2: HEX = 01 - 0000 0001&lt;BR /&gt;Byte 3: HEX = 00 - 0000&amp;nbsp;0000 &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 3 Byte 2 Byte1 Byte 0 - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;calculate the non zero th position values from right side&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte combination&amp;nbsp; - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Position -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...9 8765&amp;nbsp; 4321&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At position 14 and 17, we got 1 while counting from right side. so the bit value is 13 and 16.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;yes,&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;bit position of the least significant bit is needed..,&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:39:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699713#M237519</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-20T18:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699714#M237520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/194981"&gt;@dural_yyz&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Thanks for your reply!&lt;BR /&gt;&lt;BR /&gt;please look at this example as well, also we are having hex_code as a single field value, from that field we are seperating bit 1 and bit 2,&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;bit position of the least significant bit&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another example&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hex code - 00200100&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seperate 2 bytes each&amp;nbsp; 00/20/01/00&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4 Byte bitmask&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 0: HEX = 00 -&amp;nbsp;&amp;nbsp;0000&amp;nbsp;0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 1: HEX = 20 - 0010&amp;nbsp;0000&lt;BR /&gt;Byte 2: HEX = 01 - 0000 0001&lt;BR /&gt;Byte 3: HEX = 00 - 0000&amp;nbsp;0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte 3 Byte 2 Byte1 Byte 0 - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;calculate the non zero th position values from right side&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Byte combination&amp;nbsp; - 0000 0000 0000 0001 0010 0000 0000 0000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Position -&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;16&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;13&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...9 8765&amp;nbsp; 4321&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At position 14 and 17, we got 1 while counting from right side. so the bit value is 13 and 16.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:39:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699714#M237520</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-20T18:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699715#M237521</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Sorry for the mistake!&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I have edited in the post,&lt;BR /&gt;&lt;BR /&gt;Considering 0*63 is&amp;nbsp;&lt;SPAN&gt;01100011&lt;BR /&gt;&lt;BR /&gt;Seperating the byte as with 2positions&lt;BR /&gt;&lt;BR /&gt;byte 0 - 01 -&amp;gt; 0000 0001&lt;BR /&gt;byte 1 - 10 -&amp;gt; 0001 0000&lt;BR /&gt;byte 2 - 00 -&amp;gt; 0000 0000&lt;BR /&gt;byte 3 - 11 -&amp;gt; 0001 0001&lt;BR /&gt;&lt;BR /&gt;Combining it byte 3 byte 2 byte 1 byte 0 -&amp;nbsp;0001 0001&amp;nbsp;0000 0000&amp;nbsp;0001 0000&amp;nbsp;0000 0001&lt;BR /&gt;&lt;BR /&gt;Counting the non zero postions&amp;nbsp; - 0, 12, 24, 28&lt;BR /&gt;&lt;BR /&gt;These were the answers.&lt;BR /&gt;&lt;BR /&gt;please let me know if there are anything.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699715#M237521</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-20T18:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699719#M237523</link>
      <description>&lt;P&gt;OK. Fully honestly, I don't see the point in doing so. You're adding some synthetic zeros and then count something which will easily be divisible by 4 (because when you're preparing your bitstring he ones must be separated by multiplies of 4).&lt;/P&gt;&lt;P&gt;You're doing some strange bit swapping (and it's completely inconsistent - your original example had something that resembled a 16-bits little-endian integer which you "converted" to 32-bit value and from my single bit 0x63 value you also built a 32-bit value but obviously in a different way).&lt;/P&gt;&lt;P&gt;So, to be absolutely frank, it doesn't make much sense.&lt;/P&gt;&lt;P&gt;A completely separate thing is why would you want to do it in splunk? (actually the easiest solution could be to implement an external lookup using a python script).&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 20:18:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699719#M237523</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-20T20:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699724#M237524</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236500"&gt;@smanojkumar&lt;/a&gt;&amp;nbsp;Can you confirm that results you are looking for are like the following?&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;hex&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;padded_binary&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;nonzero_bits&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000010&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;00200100&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000001&lt;/DIV&gt;&lt;DIV class=""&gt;00100000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;13&lt;/DIV&gt;&lt;DIV class=""&gt;16&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01100011&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00010001&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00010000&lt;/DIV&gt;&lt;DIV class=""&gt;00000001&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;0&lt;/DIV&gt;&lt;DIV class=""&gt;12&lt;/DIV&gt;&lt;DIV class=""&gt;24&lt;/DIV&gt;&lt;DIV class=""&gt;28&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;This sounds like some data compression game. &amp;nbsp;I can't think of a practical reason to do this in SPL. &amp;nbsp;Is this some sort of homework?&lt;/P&gt;&lt;P&gt;Anyway, here is a more or less literal way to interpret your instructions:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval idx = mvrange(0, len(hex) / 2)
| eval reverse2hex = mvreverse(mvmap(idx, substr(hex, idx*2 + 1, 2)))
| eval ASbinary=if(idx &amp;lt; 1, tostring(tonumber(reverse2hex,16),"binary"), mvmap(reverse2hex, tostring(tonumber(reverse2hex,16),"binary")))
| eval padded_binary = if(idx &amp;lt; 1, printf("%08d", ASbinary), mvmap(ASbinary, printf("%08d", ASbinary)))
| eval reverse_bits = mvreverse(mvmap(padded_binary, split(padded_binary, ""))), position = -1
| foreach reverse_bits mode=multivalue
    [eval position = position + 1, nonzero_bits = if(&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt; == 0, nonzero_bits, mvappend(nonzero_bits, position))]
| fields hex padded_binary nonzero_bits&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note mvreverse on padded binary is sort of expensive and can be avoided by arithmetics if there are lots of data.&lt;/P&gt;&lt;P&gt;Here is the emulation of the three examples you give:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="hex
0002
00200100
01100011"
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apply the algorithm to this emulation gives the results tabulated at the top.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 01:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699724#M237524</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-22T01:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699731#M237525</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;01100011 was _not_ hex. It was binary for 0x63. That's why I'm completely confused by &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236500"&gt;@smanojkumar&lt;/a&gt; 's explanation as to how the algorithm is supposed to work. Does it work on 16-bit integers only? Does it work on any length stream of data? Does it always produce 32-bit integers? Or does the result grow with the length of the argument? It's so badly specified...&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 11:02:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699731#M237525</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-21T11:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699745#M237529</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;01100011 was _not_ hex. It was binary for 0x63. That's why I'm completely confused by&amp;nbsp;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/231884"&gt;@PickleRick&lt;/a&gt;&amp;nbsp;Lol you wouldn't believe how much time I spent trying to decipher the OP's intent from the various posted replies to everybody's attempt to help. &amp;nbsp;After hours of scrolling up and down, back and forth, I distilled the instructions into the following algorithm given an even numbered HEX string, e.g., aabbcc&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Break the string into 2-HEX chunks. (OP used the term 2-bytes - I realize that is actually 4-bytes)&lt;/LI&gt;&lt;LI&gt;Convert each chunk into binary.&lt;/LI&gt;&lt;LI&gt;Reverse the order of the binary chunks.&lt;/LI&gt;&lt;LI&gt;Count the positions of nonzero bits of the full reversed binary string from the right.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;(As I said, I can't think of a practical purpose of this exercise. By the way, to anyone who is going to ask a question here, even though I strongly encourage describing problem without SPL first, please make the description as algorithmic as possible.) &amp;nbsp;As a weird game, this applies to any even-length HEX string. &amp;nbsp;Here's a sequence of up to 16 HEX characters.&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;hex&lt;/TD&gt;&lt;TD&gt;padded_binary&lt;/TD&gt;&lt;TD&gt;nonzero_bits&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;01&lt;/TD&gt;&lt;TD&gt;00000001&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0002&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000010&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;9&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;000003&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000011&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;16&lt;/DIV&gt;&lt;DIV class=""&gt;17&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;00000004&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000100&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;26&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0000000005&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000101&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;32&lt;/DIV&gt;&lt;DIV class=""&gt;34&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;000000000006&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000110&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;41&lt;/DIV&gt;&lt;DIV class=""&gt;42&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;00000000000007&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000111&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;48&lt;/DIV&gt;&lt;DIV class=""&gt;49&lt;/DIV&gt;&lt;DIV class=""&gt;50&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0000000000000008&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00001000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;59&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;90000000000000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;10010000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;4&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;a00000000000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;10100000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;b000000000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;10110000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;4&lt;/DIV&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;c0000000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;11000000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;6&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;d00000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;11010000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;4&lt;/DIV&gt;&lt;DIV class=""&gt;6&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;e000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;00000000&lt;/DIV&gt;&lt;DIV class=""&gt;11100000&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;6&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;f0&lt;/TD&gt;&lt;TD&gt;11110000&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;4&lt;/DIV&gt;&lt;DIV class=""&gt;5&lt;/DIV&gt;&lt;DIV class=""&gt;6&lt;/DIV&gt;&lt;DIV class=""&gt;7&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Another thing I realize is that I must handle 2-HEX (single-chunk) specially. &amp;nbsp;Here is the emulation code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults format=csv data="hex
01
0002
000003
00000004
0000000005
000000000006
00000000000007
0000000000000008
90000000000000
a00000000000
b000000000
c0000000
d00000
e000
f0"
``` data emulation above ```
| eval idx = mvrange(0, len(hex) / 2)
| eval reverse2hex = mvreverse(mvmap(idx, substr(hex, idx*2 + 1, 2)))
| eval ASbinary=if(idx &amp;lt; 1, tostring(tonumber(reverse2hex,16),"binary"), mvmap(reverse2hex, tostring(tonumber(reverse2hex,16),"binary")))
| eval padded_binary = if(idx &amp;lt; 1, printf("%08d", ASbinary), mvmap(ASbinary, printf("%08d", ASbinary)))
| eval reverse_bits = mvreverse(mvmap(padded_binary, split(padded_binary, ""))), position = -1
| foreach reverse_bits mode=multivalue
    [eval position = position + 1, nonzero_bits = if(&amp;lt;&amp;lt;ITEM&amp;gt;&amp;gt; == 0, nonzero_bits, mvappend(nonzero_bits, position))]
| fields hex padded_binary nonzero_bits&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(Technically this works for odd number of HEX characters, too, if OP can define where to split.)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 01:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699745#M237529</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-09-22T01:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699763#M237532</link>
      <description>&lt;P&gt;Nice job. I'm stil not convinced it's how it was supposed to work &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 16:16:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699763#M237532</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2024-09-22T16:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699769#M237533</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236500"&gt;@smanojkumar&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This is a 16-bit adaptation of Gaudet's algorithm from &lt;EM&gt;Hacker's Delight Second Edition&lt;/EM&gt; (Warren, 2013):&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| makeresults
| eval HEX_Code="0002"
``` convert to number ```
| eval x=tonumber(HEX_Code, 16)
``` swap bytes ```
| eval x=bit_shift_right(x, 8)+bit_and(bit_shift_left(x, 8), 65280)
``` calculate number of trailing zeros (ntz) ```
| eval y=bit_and(x, 65535-x+1)
| eval bz=if(y&amp;gt;0, 0, 1), b3=if(bit_and(y, 255)&amp;gt;0, 0, 8), b2=if(bit_and(y, 3855)&amp;gt;0, 0, 4), b1=if(bit_and(y, 13107)&amp;gt;0, 0, 2), b0=if(bit_and(y, 21845)&amp;gt;0, 0, 1)
| eval ntz=bz+b3+b2+b1+b0
``` ntz=9 ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 00:37:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699769#M237533</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2024-09-23T00:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699784#M237535</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/49493"&gt;@tscroggins&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Thanks for your reply!&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I'm having this error - "&lt;SPAN&gt;Error in 'EvalCommand': The 'bit_shift_right' function is unsupported or undefined.&lt;/SPAN&gt;"&lt;BR /&gt;&lt;BR /&gt;Can you help in resolving this error.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 06:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699784#M237535</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-23T06:09:48Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699797#M237541</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Thanks for your response!&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I'm having this error "&lt;SPAN&gt;Error in 'EvalCommand': The arguments to the 'tostring' function are invalid.&lt;/SPAN&gt;", can you please help me in this.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 07:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699797#M237541</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-23T07:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699798#M237542</link>
      <description>&lt;P&gt;"binary" only came into Splunk Enterprise in 9.2.0 and doesn't appear to be in Cloud Services yet (according to the documentation)&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 07:28:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699798#M237542</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-23T07:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699799#M237543</link>
      <description>&lt;P&gt;&lt;SPAN&gt;bit-wise functions only came into Splunk Enterprise in 9.2.0 and in 9.1 in Cloud Services (according to the documentation) - which version of Splunk are you using?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 07:33:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699799#M237543</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-23T07:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699802#M237545</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Thanks for that.&lt;BR /&gt;&amp;nbsp; &amp;nbsp;I'm currebtly using Splunk Enterprise with Version 9.1.1, So thats the reason.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Any alternative way to work on this with this version?&lt;BR /&gt;&lt;BR /&gt;Thanks for pointing it out.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Manoj Kumar S&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 08:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699802#M237545</guid>
      <dc:creator>smanojkumar</dc:creator>
      <dc:date>2024-09-23T08:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conver to Hexadecimal code to bit value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699804#M237546</link>
      <description>&lt;P&gt;Having converted the number to hex, perform 16 replacements, starting with 0, then 1, replacing the hex digit with the corresponding binary equivalent.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 09:01:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Conver-to-Hexadecimal-code-to-bit-value/m-p/699804#M237546</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-09-23T09:01:17Z</dc:date>
    </item>
  </channel>
</rss>

