Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think this is what you are looking for:</p> <pre><code>Module Module1 Sub Main() Dim bytes() As Byte = {&amp;H17, &amp;H0, &amp;H0, &amp;H0, &amp;HA4, &amp;HEA, &amp;HDB, &amp;H13, &amp;H2, &amp;H0, &amp;H0, &amp;H0, &amp;H0, &amp;H0, &amp;H0, &amp;HA3, &amp;HD3, &amp;H2, &amp;HCC} Combine(New Byte() {}, bytes) End Sub Sub Combine(ByVal sequence() As Byte, ByVal pool() As Byte) ' test current sequence If Test(sequence) Then Console.Write("Found sequence: ") For Each b As Byte In sequence Console.Write("{0:X2} ", b) Next Console.WriteLine() End If ' done if pool is empty If pool.Length = 0 Then Return End If ' recurse adding next byte from the pool Dim newSequence(sequence.Length) As Byte Array.Copy(sequence, newSequence, sequence.Length) newSequence(sequence.Length) = pool(0) Dim newPool(pool.Length - 2) As Byte Array.Copy(pool, 1, newPool, 0, pool.Length - 1) Combine(newSequence, newPool) ' recurse without adding next byte from the pool Combine(sequence, newPool) End Sub Function Test(ByVal sequence() As Byte) As Boolean ' the test function that you haven't provided goes here ' this example returns True if the sequence is 4 bytes or more, causing every combination of at least 4 bytes to be printed If (sequence.Length &gt;= 4) Then Test = True Else Test = False End If End Function End Module </code></pre> <p>I leave the implementation of the Test function to you as you didn't provide that in the original question. My implementation basically treats all sequences of 4 bytes or more as passing the test, so it prints all combinations.</p> <p>I used a recursive algorithm that starts with an empty sequence and all 19 of your bytes in a "pool" of bytes. I then recurse both by moving the first byte of the pool into the sequence I'm building, then by ignoring the first byte of the pool altogether.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload