discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

md5 hashing on GNUstep


From: Andreas Höschler
Subject: md5 hashing on GNUstep
Date: Wed, 01 Apr 2020 17:43:11 +0000 (UTC)

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");
     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

[Prev in Thread] Current Thread [Next in Thread]