| 53 | } |
| 54 | |
| 55 | void transform(unsigned int length, const void* from, void* to) throw() |
| 56 | { |
| 57 | unsigned char* t = static_cast<unsigned char*>(to); |
| 58 | const unsigned char* f = static_cast<const unsigned char*>(from); |
| 59 | |
| 60 | while (length--) |
| 61 | { |
| 62 | s2 += state[++s1]; |
| 63 | swap(state[s1], state[s2]); |
| 64 | unsigned char k = state[s1] + state[s2]; |
| 65 | k = state[k]; |
| 66 | *t++ = k ^ *f++; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | private: |
| 71 | unsigned char state[256]; |