Objective-C A conversão implícita perde a precisão dos números inteiros (size_t to CC_Long)
Eu tenho uma função que está gerando uma criptografia sha256 de uma string,
Aqui está a função:
-(NSString*)sha256HashFor:(NSString*)input
{
const char* str = [input UTF8String];
unsigned char result[CC_SHA256_DIGEST_LENGTH];
CC_SHA256(str, strlen(str), result);
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH*2];
for(int i = 0; i<CC_SHA256_DIGEST_LENGTH; i++)
{
[ret appendFormat:@"%02x",result[i]];
}
return ret;
}
Agora esta linha aquiCC_SHA256(str, strlen(str), result);
é o que está produzindo esse aviso (o aviso é para a variável strlen (str)).
Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'CC_LONG' (aka 'unsigned int')
Eu estou supondo que eu só preciso converter o strlen (str) para um CC_Long, mas não tenho idéia de como fazer isso.