## Saturday, March 19, 2011

### [jrtrjwzi] Errors in the Bubble Babble specification

The bubblebabble binary data encoding specification by Antti Huima has a few errors.

```--- /tmp/original 2011-03-19 02:03:44.550808780 -0400
+++ draft-huima-01.txt 2011-03-18 20:32:15.000000000 -0400
@@ -53,7 +53,7 @@

Let the data to be encoded be D ... D[K] where K is the length
of the data in bytes; every D[i] is an integer from 0 to 2^8 - 1.
-   First define the checksum series C ... C[_|K/2|_] where
+   First define the checksum series C ... C[_|K/2|_ + 1] where

C = 1

@@ -66,11 +66,11 @@

where

-     a = (((D[i * 2 - 3] >> 6) & 3) + C[i]) mod 6
-     b = (D[i * 2 - 3] >> 2) & 15
-     c = (((D[i * 2 - 3]) & 3) + _|C[i] / 6|_) mod 6
-     d = (D[i * 2 - 2] >> 4) & 15; and
-     e = (D[i * 2 - 3]) & 15.
+     a = (((D[i * 2 - 1] >> 6) & 3) + C[i]) mod 6
+     b =   (D[i * 2 - 1] >> 2) & 15
+     c = (((D[i * 2 - 1]) & 3) + _|C[i] / 6|_) mod 6
+     d = (D[i * 2] >> 4) & 15; and
+     e = (D[i * 2]) & 15.

The partial tuple P is

@@ -78,15 +78,15 @@

where if K is even then

-     a = (C[i]) mod 6
+     a = (C[K/2 + 1]) mod 6
b = 16
-     c = _|C[i] / 6|_
+     c = _|C[K/2 + 1] / 6|_

but if it is odd then

-     a = (((D[K] >> 6) & 3) + C[i]) mod 6
+     a = (((D[K] >> 6) & 3) + C[_|K/2|_ + 1]) mod 6
b = (D[K] >> 2) & 15
-     c = (((D[K]) & 3) + _|C[i] / 6|_) mod 6
+     c = (((D[K]) & 3) + _|C[_|K/2|_ + 1] / 6|_) mod 6

The `vowel table' V maps integers between 0 and 5 to vowels as

@@ -117,6 +117,9 @@
14 - v
15 - z
16 - x
+
+   Note well that the vowel and consonant tables are indexed from 0, while
+   the data and checksum series are indexed from 1.

The encoding E(T) of a tuple T = <a, b, c, d, e> is then the string

```

Without the correction in the definition of `a b c d e`, the array indices will be negative for `i`=1.

Here is the updated version. The RCS file gives a record of my changes.

#### 1 comment :

cdslashetc said...

Interesting, I wonder if this is patched in jacksum, I must download the java source and check it out.