{"action":"created","issue":{"url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/6","repository_url":"https://api.github.com/repos/pjebs/Obfuscator-iOS","labels_url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/6/comments","events_url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/6/events","html_url":"https://github.com/pjebs/Obfuscator-iOS/issues/6","id":150629625,"number":6,"title":"hexByObfuscatingString fails due to XOR anomaly","user":{"login":"mfcollins3","id":104274,"avatar_url":"https://avatars.githubusercontent.com/u/104274?v=3","gravatar_id":"","url":"https://api.github.com/users/mfcollins3","html_url":"https://github.com/mfcollins3","followers_url":"https://api.github.com/users/mfcollins3/followers","following_url":"https://api.github.com/users/mfcollins3/following{/other_user}","gists_url":"https://api.github.com/users/mfcollins3/gists{/gist_id}","starred_url":"https://api.github.com/users/mfcollins3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfcollins3/subscriptions","organizations_url":"https://api.github.com/users/mfcollins3/orgs","repos_url":"https://api.github.com/users/mfcollins3/repos","events_url":"https://api.github.com/users/mfcollins3/events{/privacy}","received_events_url":"https://api.github.com/users/mfcollins3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-24T05:42:28Z","updated_at":"2016-04-25T18:24:22Z","closed_at":"2016-04-25T17:27:08Z","body":"I added Obfuscator-iOS to my project via CocoaPods and followed the directions to obfuscate strings. I'm trying to use hexByObfuscatingString: to obfuscate a secret key for GitHub's API, but I keep getting an error that it could not obfuscate my secret key string.\r\n\r\nI walked through the code and I think that the problem is at line number 164 in Obfuscator.m. In the reveal: method, there's this line of code:\r\n\r\n    *dataPtr = *dataPtr ^ *keyPtr;\r\n\r\nThe problem that I am seeing is that both `*dataPtr` and `*keyPtr` point to the character '8' at one index. Therefore, '8' XOR '8' is going to be byte 0. Because the code is operating on C strings, this '0' byte is prematurely terminating the obfuscated string and the obfuscated version appears to be truncated."},"comment":{"url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/comments/214470143","html_url":"https://github.com/pjebs/Obfuscator-iOS/issues/6#issuecomment-214470143","issue_url":"https://api.github.com/repos/pjebs/Obfuscator-iOS/issues/6","id":214470143,"user":{"login":"mfcollins3","id":104274,"avatar_url":"https://avatars.githubusercontent.com/u/104274?v=3","gravatar_id":"","url":"https://api.github.com/users/mfcollins3","html_url":"https://github.com/mfcollins3","followers_url":"https://api.github.com/users/mfcollins3/followers","following_url":"https://api.github.com/users/mfcollins3/following{/other_user}","gists_url":"https://api.github.com/users/mfcollins3/gists{/gist_id}","starred_url":"https://api.github.com/users/mfcollins3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfcollins3/subscriptions","organizations_url":"https://api.github.com/users/mfcollins3/orgs","repos_url":"https://api.github.com/users/mfcollins3/repos","events_url":"https://api.github.com/users/mfcollins3/events{/privacy}","received_events_url":"https://api.github.com/users/mfcollins3/received_events","type":"User","site_admin":false},"created_at":"2016-04-25T18:24:22Z","updated_at":"2016-04-25T18:24:22Z","body":"Thanks for responding. Yes, I realized as I was looking at the code more that there is really no way around this given how the code is currently implemented because it uses reveal: for both obfuscation and reversal.\r\n\r\nIf you ever re-write that part, it might be a good idea to use different methods for obfuscating and reversing. Instead of modifying the C-string in-place, you could use an NSMutableString to build the obfuscated string and implement some kind of marker for a zero byte."}}