I'm trying to calculate a hash of an audio file so I can check if its unique and prevent duplicates. I'm looking at CryptoSwift but I'm worried it won't work with large audio files. Whats the best way to get a hash on iOS?
hash of file in swift?
I believe you are correct, and CryptoSwift won't work. NSData can memory-map a file, but I think CryptoSwift's use of arrayOfBytes forces the entire thing to be loaded into memory, which is bad. You should probably find another library. Here's an article that looks like it would work:
I've done some testing and it seems CryptoSwift should be ok. I'm loading the entire song into NSData which is using a fair bit of memory but the audio files I'm using are no longer than 10 minutes in length and it seems to run fine on my old iPad.