macOS uses SHA-256 hashes extensively, and computing them is a common and demanding task. For example, code that targets macOS 10.12 or later uses SHA-256 hashing on its single code directory as the CDHash for its code signature. They are also favourites for data integrity checks in utilities like Dintch, although sometimes other methods such as MD5 may be used for speed. Although rarely included in performance benchmarks, time required to compute hashes is important when comparing systems and platforms.
Because of their ubiquity and importance, the macOS CryptoKit framework provides access to optimised implementations of SHA algorithms including SHA-256. This article compares its performance in Intel and Apple silicon Macs.
Methods
Three Macs were used, and confirmatory checks were also performed on an iMac Pro (which were consistent with my previous results):
- MacBook Pro 16-inch 2019 Intel 2.3 GHz 8-core i9 ‘Coffee Lake’, 16 GB RAM, 1 TB internal SSD, macOS 15.5;
- MacBook Pro 16-inch M3 Pro Nov 2023 6+6 M3, 36 GB RAM, 2 TB internal SSD, macOS 26.0 beta 3;
- Mac mini 2024 M4 Pro 10+4 M4, 48 GB RAM, 2 TB internal SSD, macOS 15.5.
Tests have been previously reported here on the last of those using Thunderbolt 5 and USB4 SSDs, and earlier.
Net SHA-256 throughput, including reading from disk and computation of the SHA-256 digest, was measured on test files ranging in size from 100 MB to 10 GB, although for clarity figures given are only for 10 GB test files, which were invariably the fastest. These were measured using Dintch at maximum and minimum Quality of Service (QoS) settings. Swift source code for this is given in the Appendix. Read speeds were measured on the same files using Stibium.
Results
The two Apple silicon Macs were much faster at computing SHA-256 digests of large files than the Intel models. Even at maximum QoS, the Intel Mac was significantly slower than both the M3 and M4 Mac computing the digests at minimum QoS, on their E cores alone. At maximum QoS, net throughput of the Intel 2.3 GHz 8-core i9 was 16% that of the M4 Pro, making the M4 Pro over 6 times faster than the Intel processor.
Simple read speeds of the internal SSD also differed, with the Intel MacBook Pro reading the 10 GB test file at 37% of the speed of the M4 Pro.
Net throughput of the SHA-256 computation in the Intel Mac was 17% of the read speed of its SSD, much lower than the equivalent values for the M3 Pro (48%) and M4 Pro (40%), implying that the differences were largely the result of poorer performance of the Intel processor in computing the SHA-256 digest, rather than in streaming the file from disk.
SHA-256 implementations
Although Apple provides no details on how CryptoKit implements SHA-256 digest computation on Intel or Apple silicon chips, there are likely to be substantial differences in CPU instruction support.
Intel first introduced support for SHA-256 in instructions from 2013, and those are detailed here. However, identifying which Intel processors implement its SHA extensions isn’t clear. Wikipedia reports that they weren’t supported until Cannon Lake in 2018, after Coffee Lake used in the MacBook Pro 2019 tested here.
In contrast, all M-series CPU instruction sets support Arm’s SHA extensions. It’s therefore likely that the comparison being made here is between SHA-256 implemented in software, and in hardware.
There are many comparisons of hash functions implemented in software, for example in a MacBook Pro with a slower 4-core i5 by Marut Pandya, and in a Linux system by Peng Wang and others. However, these are the first performance figures I have seen for the hardware implementation in Apple silicon chips, other than my earlier article. They suggest that M-series chips deliver superior performance to any comparable software, and would remain faster than software implementations of blake2 or MD5.
Conclusions
Apple CryptoKit implementation of the computation of SHA-256 digests is up to six times faster in M-series chips than in its late Intel models. It’s likely to outperform all currently available software hashing methods, and is to be preferred as a means of checking data integrity. Its use in CDHashes is likely to contribute significantly to improved performance of security tasks in Apple silicon Macs.