Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base64 decoding error #4

Open
wvdhaute opened this issue Nov 7, 2014 · 0 comments
Open

base64 decoding error #4

wvdhaute opened this issue Nov 7, 2014 · 0 comments

Comments

@wvdhaute
Copy link
Contributor

wvdhaute commented Nov 7, 2014

Hey Maarten,

Seems to be an error in the base64 decoding algo
Try encoding the string "Test description" and decoding it back using your algo vs the ios7 decoding

Thought you should know but I guess since ios7 introduced a native base64 api and opened up a private api for ios versions < 7 yours can go away

    NSString *test = @"Test description";
    NSData *testBytes = [test dataUsingEncoding:NSUTF8StringEncoding];
    NSString *testResult = [testBytes encodeBase64];
    dbg(@"result: %@", testResult);
    NSData *testBytes2 = [testResult decodeBase64];
    NSString *testResult2 = [[NSString alloc] initWithData:testBytes2 encoding:NSUTF8StringEncoding];
    dbg(@"result2: %@", testResult2);
    NSData *testBytes3 = [[NSData alloc] initWithBase64EncodedString:testResult options:0];
    NSString *testResult3 = [[NSString alloc] initWithData:testBytes3 encoding:NSUTF8StringEncoding];
    dbg(@"result3: %@", testResult3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant