Examples of ausLowIndex and ausHighIndex

Suppose that, in some hypothetical transformation, nulls are discarded and 10 is an escape character that causes the character following it to be used after 20 has been subtracted from it. Then, if abytLayer comprises [00, 10, 25], abVirtualFrame will end up containing [5], ausLowIndex[0] will be 1 and ausHighIndex[0] will be 2.

A slightly more complicated example:

If abytLayer comprises [00, 10, 25, 10, 26], then abVirtualFrame will contain [5, 6], and the following will be true:

abVirtualFrame[0] = 5, ausLowIndex[0] = 1, ausHighIndex[0] = 2

abVirtualFrame[1] = 6, ausLowIndex[1] = 3, ausHighIndex[1] = 4

Another way of looking at it would be like this:

Index

0

1

2

3

4

Old Data

00

10

25

10

26

New Frame Data

5

6




ausLowIndex

1

3




ausHighIndex

2

4




Looking at index 0 of the new record, ausLowIndex and ausHighIndex are 1 and 2 respectively because it took both the 10 and 25 bytes to make up the 5 byte. Note that index 0 in the old record is ignored.

Looking at index 0 of the new record, ausLowIndex and ausHighIndex are 1 and 2 respectively because it took both the 10 and 25 bytes to make up the 5 byte. Note that index 0 in the old record is ignored.

Rules: any instance of BARNEY is to be replaced with FRED. Any Instance of RUBBLE is to be replaced with FLINTSTONE.

Index

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

Old Data

1

2

3

B

A

R

N

E

Y

4

5

6

R

U

B

B

L

E



New Data

1

2

3

F

R

E

D

4

5

6

F

L

I

N

T

S

T

O

N

E

ausLowIndex

0

1

2

3

4

5

6

9

10

11

12

13

14

15

16

17

ffff

ffff

ffff

ffff

ausHighIndex

0

1

2

3

4

5

8

9

10

11

12

13

14

15

16

17

ffff

ffff

ffff

ffff

ffff means 0xffff. ausLow/HighIndex are arrays of unsigned. You can’t use -1.

The thing here is that we don’t have a simple byte for byte substitution. We actually have two problems.

Barney, a 6 character token has been replaced by Fred, a 4 character token. There are simply not enough characters in the new message to account for every character in the old. We do the best we can by mapping as much as we can. Note that at index 7 we mapped the final character in Fred to the last three characters of Barney.

Rubble, a 6 character token has been replaced with Flintstone, a 10 character token. We map the first 6 characters and put in -1s for the last four.

An alternative might be this:

Index

0

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

Old Data

1

2

3

B

A

R

N

E

Y

4

5

6

R

U

B

B

L

E



New Data

1

2

3

F

R

E

D

4

5

6

F

L

I

N

T

S

T

O

N

E

ausLowIndex

0

1

2

3

3

3

3

9

10

11

12

12

12

12

12

12

12

12

12

12

ausHighIndex

0

1

2

8

8

8

8

9

10

11

17

17

17

17

17

17

17

17

17

17

The problem here is that the first part of the message was never in this frame. We can’t map a character back to the previous frame so we need placeholders in the Low and High Index arrays to indicate that we didn’t get this data from the frame.