Portrait

I2H3

Notes from work as an app developer for iPhones, iPads and Macs.

RSS Icon GitHub Mastodon

MD5 Performance Test App

Out of necessity I created a minimalistic SwiftUI app which performs MD5 hashing to get a rough feeling how efficient it is on Apple devices.

I know and everybody should know that MD5 is not safe anymore since a long time. At least for hashing passwords. For file integrity checks it is still fine to use, though. Correct me, if I am wrong!

I have to work with an online service and protocol in which MD5 checksums are essential for historical reasons to ensure content integrity. The feasibility to hash large content files like recorded videos on a device like older iPhone models was in question. To get a rough impression I wrote a minimalistic SwiftUI which renders and hashes a random file. It turns out, that these devices appear to quite efficient. Obviously, I did not write a professional benchmark app but it should suffice.

I did some test runs with devices I have at hand and these are the results. I also have an iPhone 8 here as a test device which is not supported by iOS 17 anymore, though. The lack of SwiftData on one hand and the unnecessary support for that release on the other, should the product ever see the light of the day, explain its exclusion.

It is important to note that these all are DEBUG builds with the Xcode debugger attached.

Simulator

The configuration specifically is:

  • iPhone 15 Pro Max
  • iOS 17.0.1
  • Xcode Version 15.2
  • macOS Sonoma 14.3.1
  • 13" M1 MacBook Pro from 2020
File Size Chunk Size Duration
1 GB 100 KB 2.1 s
1 GB 1 MB 2.0 s
1 GB 10 MB 2.1 s
10 GB 100 KB 21.6 s
10 GB 1 MB 20.4 s
10 GB 10 MB 21.4 s

iPhone SE (3rd Gen)

Introduced in 2022, it comes with an Apple A15 Bionic chip. My device here has iOS 17.3.1 installed.

File Size Chunk Size Duration
1 GB 100 KB 2.3 s
1 GB 1 MB 2.3 s
1 GB 10 MB 3.0 s
10 GB 100 KB 21.0 s
10 GB 1 MB 21.0 s
10 GB 10 MB 31.9 s

iPhone XS Max

Introduced in 2018, it comes with an Apple A12 Bionic chip.

File Size Chunk Size Duration
1 GB 100 KB 2.8 s
1 GB 1 MB 2.8 s
1 GB 10 MB 3.5 s
10 GB 100 KB 29.0 s
10 GB 1 MB 29.5 s
10 GB 10 MB 37.6 s

Summary

Overall, hashing large files appears feasible on such devices. There do not appear to be large differences between the devices. I assume nearly all devices share a hardware accelerated hashing implementation and do not perform it in software which would explain the very similar performances.

It is notable that the iPhone XS Max is one of the oldest devices still supported by iOS 17. I would not be surprised, if it is no longer supported by iOS 18.