Have a look at libs-base/Source/Additions/NSData+GNUstepBase.m

> Am 01.04.2020 um 19:46 schrieb H. Nikolaus Schaller <h...@goldelico.com>:
> 
>> 
>> Am 01.04.2020 um 19:43 schrieb Andreas Höschler <ahoe...@smartsoft.de>:
>> 
>> Hi all,
>> 
>> I have the following NSString category 
>> 
>>  @implementation NSString (NSStringJsonExtension)
>> 
>>  - (NSString *)md5
>>    {
>>     #ifdef __APPLE__
>>     const char *cStr = [self UTF8String];
>>     unsigned char result[CC_MD5_DIGEST_LENGTH];
>>     CC_MD5( cStr, (int)strlen(cStr), result ); // This is the md5 call
>>     return [NSString stringWithFormat:
>>     @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
>>     result[0], result[1], result[2], result[3], 
>>     result[4], result[5], result[6], result[7],
>>     result[8], result[9], result[10], result[11],
>>     result[12], result[13], result[14], result[15]
>>     ];  
>>     #else
>>     NSLog(@"md5 not yet supported on GNUstep. Please implement");
> 
> https://linux.die.net/man/3/md5_init
> 
> maybe
>       unsigned char *MD5(cStr, strlen(cStr), result);
> 
> You need to install openssl devel packages.
> 
> 
>>     return nil;
>>     #endif
>>    }
>> 
>> @end
>> 
>> working on MacOSX (neede to access HkVision cameras). 
>> 
>> I would like to port this app to GNUstep and therefore need code that builds 
>> on Ubuntu (current GNUstep tree). The above code gives
>> 
>> SRHTTPRequest.m:93:27: error: 'CC_MD5_DIGEST_LENGTH' undeclared (first use 
>> in this function)
>>      unsigned char result[CC_MD5_DIGEST_LENGTH];
>>                           ^
>> SRHTTPRequest.m:93:27: note: each undeclared identifier is reported only 
>> once for each function it appears in
>> SRHTTPRequest.m:94:6: warning: implicit declaration of function 'CC_MD5' 
>> [-Wimplicit-function-declaration]
>>      CC_MD5( cStr, (int)strlen(cStr), result ); // This is the md5 call
>>      ^
>> Any idea how to do md5 hashing on Linux/GNUstep?
>> 
>> Thanks a lot in advance!
>> 
>> Andreas


Reply via email to