mirror of
https://github.com/KyleBanks/XOREncryption.git
synced 2023-08-10 21:13:15 +03:00
Fix Objective-C implementation, it has different result comparing to others.
Division operator and modulo operator have the same priority. So the result of "i % sizeof(key)/sizeof(unichar)" is the same as "(i % sizeof(key)) / sizeof(unichar)". But expected result should be "i % (sizeof(key)/sizeof(unichar))".
This commit is contained in:
parent
88e695bebd
commit
15d89e91e8
@ -19,7 +19,7 @@
|
||||
|
||||
for(int i = 0; i < input.length; i++) {
|
||||
unichar c = [input characterAtIndex:i];
|
||||
c ^= key[i % sizeof(key)/sizeof(unichar)];
|
||||
c ^= key[i % (sizeof(key)/sizeof(unichar))];
|
||||
[output appendString:[NSString stringWithFormat:@"%C", c]];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user