Encodes input (u32) into output (u8). Assumes len is a multiple of 4. */
| 261 | a multiple of 4. |
| 262 | */ |
| 263 | static void Encode(u8* output, u32* input, u32 len) |
| 264 | { |
| 265 | u32 i, j; |
| 266 | |
| 267 | for (i = 0, j = 0; j < len; i++, j += 4) { |
| 268 | output[j] = (u8)(input[i] & 0xff); |
| 269 | output[j+1] = (u8)((input[i] >> 8) & 0xff); |
| 270 | output[j+2] = (u8)((input[i] >> 16) & 0xff); |
| 271 | output[j+3] = (u8)((input[i] >> 24) & 0xff); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | /* Decodes input (u8) into output (u32). Assumes len is |
| 276 | a multiple of 4. |