mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
When using $encode's 'bc' switches for CBC, error '* Line too long: $encode' occurs for binary variables of lengths 16 and also lengths 1 thru 10 except for length 7. The binary contents do not appear to matter, nor does choice of padding or salt/iv switches. Does not happen with the 'e' switch nor for plaintext defined with text or %variables. Perhaps related to the same error message mentioned in versions.txt for v7.44

To reproduce, load this code then type: /encode_test

Code:
alias encode_test {
  echo -a $ $+ 1 is optional ascii number 0-255
  var %N 1 | var %chr $iif($1 isnum 0-255,$v1,49)
  while (%N isnum 1-17) {
    bset -c &bin 1 $str( %chr $+ $chr(32),%N)
    noop $encode(&bin,bc,key)
    echo 4 -a Length %N encoded as $bvar(&bin,1-).text
    noop $decode(&bin,bc,key)
    echo 2 -a Length %N decoded as length $bvar(&bin,0) $+ :  $bvar(&bin,1-).text
    goto label

    :error
    echo 3 -a error for length N= %N : $error $bvar(&bin,1-).text
    reseterror

    :label
    inc %N
  }
  return
}

Joined: Jan 2004
Posts: 2,127
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Update: This bug is affected by the u/m/a switches. The example used the default u switch, but when switches for $encode and $decode change from bc to bcm, the error at binary lengths 5-6 disappears, but the errors for the other lengths 1-4,8-10,16 remain.

When changing switches to be bca for Base32, the series of lengths affected by the bug expands to: 1-20,24-28,32-36,40,48.

Update2:

I was incorrect when I said the IV/Salt switches didn't matter. Switches 'bcr' and bcs with Salt had the bug in the same lengths, but switches 'bci' with IV didn't have the bug regardless of u/m/a encoding.

Last edited by maroon; 05/12/17 05:04 PM.
Joined: Dec 2002
Posts: 5,424
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,424
Thanks for your bug report. This issue has been fixed for the next version.


Link Copied to Clipboard