Let CSStab0 be an array of length 11 each element of which is an unsigned
integer, whose initial value is the array with elements 5, 0, 1, 2, 3, 4, 0,
1, 2, 3, and 4. Let CSStab1 be an array of length 256 each element of which
is an unsigned character, whose initial value is the array with elements 51,
115, 59, 38, 99, 35, 107, 118, 62, 126, 54, 43, 110, 46, 102, 123, 211, 147,
219, 6, 67, 3, 75, 150, 222, 158, 214, 11, 78, 14, 70, 155, 87, 23, 95, 130,
199, 135, 207, 18, 90, 26, 82, 143, 202, 138, 194, 31, 217, 153, 209, 0, 73,
9, 65, 144, 216, 152, 208, 1, 72, 8, 64, 145, 61, 125, 53, 36, 109, 45, 101,
116, 60, 124, 52, 37, 108, 44, 100, 117, 221, 157, 213, 4, 77, 13, 69, 148,
220, 156, 212, 5, 76, 12, 68, 149, 89, 25, 81, 128, 201, 137, 193, 16, 88,
24, 80, 129, 200, 136, 192, 17, 215, 151, 223, 2, 71, 7, 79, 146, 218, 154,
210, 15, 74, 10, 66, 159, 83, 19, 91, 134, 195, 131, 203, 22, 94, 30, 86,
139, 206, 142, 198, 27, 179, 243, 187, 166, 227, 163, 235, 246, 190, 254,
182, 171, 238, 174, 230, 251, 55, 119, 63, 34, 103, 39, 111, 114, 58, 122,
50, 47, 106, 42, 98, 127, 185, 249, 177, 160, 233, 169, 225, 240, 184, 248,
176, 161, 232, 168, 224, 241, 93, 29, 85, 132, 205, 141, 197, 20, 92, 28, 84,
133, 204, 140, 196, 21, 189, 253, 181, 164, 237, 173, 229, 244, 188, 252,
180, 165, 236, 172, 228, 245, 57, 121, 49, 32, 105, 41, 97, 112, 56, 120, 48,
33, 104, 40, 96, 113, 183, 247, 191, 162, 231, 167, 239, 242, 186, 250, 178,
175, 234, 170, 226, and 255. Let CSStab2 be an array of length 256 each
element of which is an unsigned character, whose initial value is the array
with elements 0, 1, 2, 3, 4, 5, 6, 7, 9, 8, 11, 10, 13, 12, 15, 14, 18, 19,
16, 17, 22, 23, 20, 21, 27, 26, 25, 24, 31, 30, 29, 28, 36, 37, 38, 39, 32,
33, 34, 35, 45, 44, 47, 46, 41, 40, 43, 42, 54, 55, 52, 53, 50, 51, 48, 49,
63, 62, 61, 60, 59, 58, 57, 56, 73, 72, 75, 74, 77, 76, 79, 78, 64, 65, 66,
67, 68, 69, 70, 71, 91, 90, 89, 88, 95, 94, 93, 92, 82, 83, 80, 81, 86, 87,
84, 85, 109, 108, 111, 110, 105, 104, 107, 106, 100, 101, 102, 103, 96, 97,
98, 99, 127, 126, 125, 124, 123, 122, 121, 120, 118, 119, 116, 117, 114, 115,
112, 113, 146, 147, 144, 145, 150, 151, 148, 149, 155, 154, 153, 152, 159,
158, 157, 156, 128, 129, 130, 131, 132, 133, 134, 135, 137, 136, 139, 138,
141, 140, 143, 142, 182, 183, 180, 181, 178, 179, 176, 177, 191, 190, 189,
188, 187, 186, 185, 184, 164, 165, 166, 167, 160, 161, 162, 163, 173, 172,
175, 174, 169, 168, 171, 170, 219, 218, 217, 216, 223, 222, 221, 220, 210,
211, 208, 209, 214, 215, 212, 213, 201, 200, 203, 202, 205, 204, 207, 206,
192, 193, 194, 195, 196, 197, 198, 199, 255, 254, 253, 252, 251, 250, 249,
248, 246, 247, 244, 245, 242, 243, 240, 241, 237, 236, 239, 238, 233, 232,
235, 234, 228, 229, 230, 231, 224, 225, 226, and 227. Let CSStab3 be an array
of length 512 each element of which is an unsigned character, whose initial
value is the array with elements 0, 36, 73, 109, 146, 182, 219, 255, 0, 36,
73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73,
109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109,
146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146,
182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182,
219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219,
255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255,
0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0,
36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36,
73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73,
109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109,
146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146,
182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182,
219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219,
255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255,
0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0,
36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36,
73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73,
109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109,
146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146,
182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182,
219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219,
255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255,
0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0,
36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36,
73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73,
109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109,
146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146,
182, 219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182,
219, 255, 0, 36, 73, 109, 146, 182, 219, 255, 0, 36, 73, 109, 146, 182, 219,
255, 0, 36, 73, 109, 146, 182, 219, and 255. Let CSStab4 be an array of
length 256 each element of which is an unsigned character, whose initial
value is the array with elements 0, 128, 64, 192, 32, 160, 96, 224, 16, 144,
80, 208, 48, 176, 112, 240, 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88,
216, 56, 184, 120, 248, 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212,
52, 180, 116, 244, 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60,
188, 124, 252, 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178,
114, 242, 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186,
122, 250, 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118,
246, 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126,
254, 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, 5,
133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, 13,
141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, 3, 131,
67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, 11, 139, 75,
203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, 7, 135, 71, 199,
39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, 15, 143, 79, 207, 47,
175, 111, 239, 31, 159, 95, 223, 63, 191, 127, and 255. Let CSStab5 be an
array of length 256 each element of which is an unsigned character, whose
initial value is the array with elements 255, 127, 191, 63, 223, 95, 159, 31,
239, 111, 175, 47, 207, 79, 143, 15, 247, 119, 183, 55, 215, 87, 151, 23,
231, 103, 167, 39, 199, 71, 135, 7, 251, 123, 187, 59, 219, 91, 155, 27, 235,
107, 171, 43, 203, 75, 139, 11, 243, 115, 179, 51, 211, 83, 147, 19, 227, 99,
163, 35, 195, 67, 131, 3, 253, 125, 189, 61, 221, 93, 157, 29, 237, 109, 173,
45, 205, 77, 141, 13, 245, 117, 181, 53, 213, 85, 149, 21, 229, 101, 165, 37,
197, 69, 133, 5, 249, 121, 185, 57, 217, 89, 153, 25, 233, 105, 169, 41, 201,
73, 137, 9, 241, 113, 177, 49, 209, 81, 145, 17, 225, 97, 161, 33, 193, 65,
129, 1, 254, 126, 190, 62, 222, 94, 158, 30, 238, 110, 174, 46, 206, 78, 142,
14, 246, 118, 182, 54, 214, 86, 150, 22, 230, 102, 166, 38, 198, 70, 134, 6,
250, 122, 186, 58, 218, 90, 154, 26, 234, 106, 170, 42, 202, 74, 138, 10,
242, 114, 178, 50, 210, 82, 146, 18, 226, 98, 162, 34, 194, 66, 130, 2, 252,
124, 188, 60, 220, 92, 156, 28, 236, 108, 172, 44, 204, 76, 140, 12, 244,
116, 180, 52, 212, 84, 148, 20, 228, 100, 164, 36, 196, 68, 132, 4, 248, 120,
184, 56, 216, 88, 152, 24, 232, 104, 168, 40, 200, 72, 136, 8, 240, 112, 176,
48, 208, 80, 144, 16, 224, 96, 160, 32, 192, 64, 128, and 0.
Let CSSdescramble be a function with no result. It is called with arguments
sec and key, where sec is a pointer to an unsigned character and key is a
pointer to an unsigned character. To perform the function, let t1, t2, t3,
t4, t5, and t6 each be an unsigned integer. Let "end" be a pointer to an
unsigned character, whose initial value is sec plus 2048. Set t1 equal to the
bitwise or of e1 and 256, where e1 is the bitwise exclusive or of the element
of key at index 0 and the element of sec at index 84. Then set t2 equal to
the bitwise exclusive or of the element of key at index 1 and the element of
sec at index 85. Next, set t3 equal to the bitwise exclusive or of the
variable pointed to by e1 and the variable pointed to by e2, where e1 is e3
cast to a pointer to an unsigned integer, e2 is e4 cast to a pointer to an
unsigned integer, e3 is key plus 2, and e4 is sec plus 86. After that, set t4
equal to the bitwise and of t3 and 7. Then set t3 equal to e1, where e1 is e2
minus t4, e2 is e3 plus 8, and e3 is t3 times 2. Next, increment sec by 128.
After that, set t5 equal to 0. Then continue to perform block 1 as long as
sec is not equal to "end" at the beginning of the iteration. To perform block
1, first set t4 equal to the bitwise exclusive or of the element of CSStab2
at index t2 and the element of CSStab3 at index t1. Next, set t2 equal to e1,
where e1 is t1 shifted right 1 bits. After that, set t1 equal to the bitwise
exclusive or of e1 and t4, where e1 is e2 shifted left 8 bits and e2 is the
bitwise and of t1 and 1. Then set t4 equal to the element of CSStab5 at index
t4. Next, set t6 equal to the bitwise and of e1 and 255, where e1 is e2
shifted right 5 bits, e2 is the bitwise exclusive or of e3 and t3, e3 is e4
shifted right 8 bits, e4 is the bitwise exclusive or of e5 and t3, e5 is e6
shifted right 1 bits, e6 is the bitwise exclusive or of e7 and t3, and e7 is
t3 shifted right 3 bits. After that, set t3 equal to the bitwise or of e1 and
t6, where e1 is t3 shifted left 8 bits. Then set t6 equal to the element of
CSStab4 at index t6. Next, increment t5 by e1, where e1 is t6 plus t4. After
that, set the variable pointed to by e1 equal to the bitwise exclusive or of
the element of CSStab1 at index e2 and e3, where e1 is sec before
incrementing sec by one, e2 is the variable pointed to by sec, and e3 is the
bitwise and of t5 and 255. Then assign t5 shifted right 8 bits to t5. This
ends block 1.
Let CSStitlekey1 be a function with no result. It is called with arguments
key and im, where key is a pointer to an unsigned character and im is a
pointer to an unsigned character. To perform the function, let t1, t2, t3,
t4, t5, and t6 each be an unsigned integer. Let k be an array of length 5
each element of which is an unsigned character. Let i be an integer. Set t1
equal to the bitwise or of the element of im at index 0 and 256. Next, set t2
equal to the element of im at index 1. After that, set t3 equal to the
variable pointed to by e1, where e1 is e2 cast to a pointer to an unsigned
integer and e2 is im plus 2. Then set t4 equal to the bitwise and of t3 and
7. Next, set t3 equal to e1, where e1 is e2 minus t4, e2 is e3 plus 8, and e3
is t3 times 2. After that, set t5 equal to 0. Then continue to perform block
2 as long as i is less than 5 prior to the iteration; before starting this
loop, set i equal to 0; upon completion of each iteration of the loop,
increment i by one. To perform block 2, first set t4 equal to the bitwise
exclusive or of the element of CSStab2 at index t2 and the element of CSStab3
at index t1. Next, set t2 equal to e1, where e1 is t1 shifted right 1 bits.
After that, set t1 equal to the bitwise exclusive or of e1 and t4, where e1
is e2 shifted left 8 bits and e2 is the bitwise and of t1 and 1. Then set t4
equal to the element of CSStab4 at index t4. Next, set t6 equal to the
bitwise and of e1 and 255, where e1 is e2 shifted right 5 bits, e2 is the
bitwise exclusive or of e3 and t3, e3 is e4 shifted right 8 bits, e4 is the
bitwise exclusive or of e5 and t3, e5 is e6 shifted right 1 bits, e6 is the
bitwise exclusive or of e7 and t3, and e7 is t3 shifted right 3 bits. After
that, set t3 equal to the bitwise or of e1 and t6, where e1 is t3 shifted
left 8 bits. Then set t6 equal to the element of CSStab4 at index t6. Next,
increment t5 by e1, where e1 is t6 plus t4. After that, set the element of k
at index i equal to the bitwise and of t5 and 255. Then assign t5 shifted
right 8 bits to t5. This ends block 2. Continuing on, we next continue to set
the element of key at index e1 equal to the bitwise exclusive or of e2 and
the element of key at index e3, where e1 is the element of CSStab0 at index
e4, e2 is the bitwise exclusive or of the element of k at index e5 and the
element of CSStab1 at index e6, e3 is the element of CSStab0 at index i, e4
is i plus 1, e5 is the element of CSStab0 at index e7, e6 is the element of
key at index e8, e7 is i plus 1, e8 is the element of CSStab0 at index e9,
and e9 is i plus 1 as long as i is greater than or equal to 0 prior to the
iteration; before starting this loop, set i equal to 9; upon completion of
each iteration of the loop, decrement i by one.
Let CSStitlekey2 be a function with no result. It is called with arguments
key and im, where key is a pointer to an unsigned character and im is a
pointer to an unsigned character. To perform the function, let t1, t2, t3,
t4, t5, and t6 each be an unsigned integer. Let k be an array of length 5
each element of which is an unsigned character. Let i be an integer. Set t1
equal to the bitwise or of the element of im at index 0 and 256. Next, set t2
equal to the element of im at index 1. After that, set t3 equal to the
variable pointed to by e1, where e1 is e2 cast to a pointer to an unsigned
integer and e2 is im plus 2. Then set t4 equal to the bitwise and of t3 and
7. Next, set t3 equal to e1, where e1 is e2 minus t4, e2 is e3 plus 8, and e3
is t3 times 2. After that, set t5 equal to 0. Then continue to perform block
3 as long as i is less than 5 prior to the iteration; before starting this
loop, set i equal to 0; upon completion of each iteration of the loop,
increment i by one. To perform block 3, first set t4 equal to the bitwise
exclusive or of the element of CSStab2 at index t2 and the element of CSStab3
at index t1. Next, set t2 equal to e1, where e1 is t1 shifted right 1 bits.
After that, set t1 equal to the bitwise exclusive or of e1 and t4, where e1
is e2 shifted left 8 bits and e2 is the bitwise and of t1 and 1. Then set t4
equal to the element of CSStab4 at index t4. Next, set t6 equal to the
bitwise and of e1 and 255, where e1 is e2 shifted right 5 bits, e2 is the
bitwise exclusive or of e3 and t3, e3 is e4 shifted right 8 bits, e4 is the
bitwise exclusive or of e5 and t3, e5 is e6 shifted right 1 bits, e6 is the
bitwise exclusive or of e7 and t3, and e7 is t3 shifted right 3 bits. After
that, set t3 equal to the bitwise or of e1 and t6, where e1 is t3 shifted
left 8 bits. Then set t6 equal to the element of CSStab5 at index t6. Next,
increment t5 by e1, where e1 is t6 plus t4. After that, set the element of k
at index i equal to the bitwise and of t5 and 255. Then assign t5 shifted
right 8 bits to t5. This ends block 3. Continuing on, we next continue to set
the element of key at index e1 equal to the bitwise exclusive or of e2 and
the element of key at index e3, where e1 is the element of CSStab0 at index
e4, e2 is the bitwise exclusive or of the element of k at index e5 and the
element of CSStab1 at index e6, e3 is the element of CSStab0 at index i, e4
is i plus 1, e5 is the element of CSStab0 at index e7, e6 is the element of
key at index e8, e7 is i plus 1, e8 is the element of CSStab0 at index e9,
and e9 is i plus 1 as long as i is greater than or equal to 0 prior to the
iteration; before starting this loop, set i equal to 9; upon completion of
each iteration of the loop, decrement i by one.
Let CSSdecrypttitlekey be a function with no result. It is called with
arguments tkey and dkey, where tkey is a pointer to an unsigned character and
dkey is a pointer to an unsigned character. To perform the function, let i be
an integer. Let im1 be an array of length 6 each element of which is an
unsigned character. Let im2 be an array of length 6 each element of which is
an unsigned character, whose initial value is the array with elements 81,
103, 103, 197, 224, and 0. Continue to set the element of im1 at index i
equal to the element of dkey at index i as long as i is less than 6 prior to
the iteration; before starting this loop, set i equal to 0; upon completion
of each iteration of the loop, increment i by one. Next, pass im1 and im2 to
CSStitlekey1. After that, pass tkey and im1 to CSStitlekey2.