How do I create a hash of a file on iOS?

后端 未结 3 1505
猫巷女王i
猫巷女王i 2020-12-16 05:05

I\'m trying to create unique file names by renaming them using their hashed value in iOS. How can I do that?

3条回答
  •  情书的邮戳
    2020-12-16 05:28

    Why don't you simply generate unique identifiers and use it? like

    CFUUIDRef uuidObj = CFUUIDCreate(nil);
    NSString *uniqueId = (NSString*)CFUUIDCreateString(nil, uuidObj);
    CFRelease(uuidObj);
    NSLog(@"%@",uniqueId);
    [uniqueId autorelease];
    

提交回复
热议问题