Generate hash from UIImage

前端 未结 4 1690
忘了有多久
忘了有多久 2020-11-28 07:59

I\'m trying to compare two UIImages from the file system to see if they are the same. Obviously, I can\'t use NSObject\'s hash method, since this returns a hash of the objec

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-28 08:55

    more elegant code below

    +(NSString *)MD5HexDigest:(NSData *)input {
        unsigned char result[CC_MD5_DIGEST_LENGTH];
    
        CC_MD5(input.bytes, (unsigned int)input.length, result);
        NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
        for (int i = 0; i

提交回复
热议问题