Tag Archives: objective-c

Objective-C Default Argument Value

Questions: Hey there, quick question here. I’m sure there’s a simple answer. Coming from PHP, I’m used to declaring a function with a default argument value like this: function myFunction ($array, $sort = FALSE) { } I the sort parameter wasn’t filled, the function would continue with the default value of false. In Obj-C, is… Read More »

Sha256 in Objective-C for iPhone

Questions: When I use this code to create a sha256 of a string unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@”hello”]; NSData * inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; CC_SHA256(inputData.bytes, inputData.length, hashedChars); It returns the hash correctly, but I need to insert a string like this \x00\x25\x53 and in this case, the function returns a sha256… Read More »

Sha256 in Objective-C for iPhone

Questions: When I use this code to create a sha256 of a string unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@”hello”]; NSData * inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; CC_SHA256(inputData.bytes, inputData.length, hashedChars); It returns the hash correctly, but I need to insert a string like this \x00\x25\x53 and in this case, the function returns a sha256… Read More »

Sha256 in Objective-C for iPhone

Questions: When I use this code to create a sha256 of a string unsigned char hashedChars[32]; NSString *inputString; inputString = [NSString stringWithFormat:@”hello”]; NSData * inputData = [inputString dataUsingEncoding:NSUTF8StringEncoding]; CC_SHA256(inputData.bytes, inputData.length, hashedChars); It returns the hash correctly, but I need to insert a string like this \x00\x25\x53 and in this case, the function returns a sha256… Read More »