| 71 | } |
| 72 | |
| 73 | void ARC4_Base::ProcessData(byte *outString, const byte *inString, size_t length) |
| 74 | { |
| 75 | if (length == 0) |
| 76 | return; |
| 77 | |
| 78 | byte *const s = m_state; |
| 79 | unsigned int x = m_x; |
| 80 | unsigned int y = m_y; |
| 81 | |
| 82 | if (inString == outString) |
| 83 | { |
| 84 | do |
| 85 | { |
| 86 | *outString++ ^= MakeByte(x, y, s); |
| 87 | } while (--length); |
| 88 | } |
| 89 | else |
| 90 | { |
| 91 | do |
| 92 | { |
| 93 | *outString++ = *inString++ ^ byte(MakeByte(x, y, s)); |
| 94 | } |
| 95 | while(--length); |
| 96 | } |
| 97 | |
| 98 | m_x = byte(x); |
| 99 | m_y = byte(y); |
| 100 | } |
| 101 | |
| 102 | void ARC4_Base::DiscardBytes(size_t length) |
| 103 | { |