Hi everyone, I'm developing an app for macOS and eventually will bring it to iOS. It's a shoebox type of app written in Swift which will manage potentialy a lot of files. I'm currently desining the data model of my app and I'm considering using some kind of file checksum/digest such as SHA1 as a unique identifier property, which could be used as well for finding duplicates and verifying for eventual data corruption.
Right now I have found the command line utility /usr/bin/shasum that I can use through a Process, but I don't like having to use a hard coded path to an executable ( is it even available on iOS? what if Apple decides to remove it in future releases? )
So I've been looking a other APIs and came across the Security framework but I'm not quite sure it's what I need, my app will not do any encryption of data, and it seems that is mainly what that framework is all about.
Any suggestions or guidance would be aprreciated.
You can use CommonCrypto, then. The digest functions are in <CommonCrypto/CommonDigest.h>. The routines are documented in man pages (e.g. here). See this thread for reassurance that it's still supported and recommended, at least as of 2 years ago. It's also currently listed at Apple's Security developer page, as a peer to SecKey.