Why does "Turn Passcode Off" on iOS take so long? Actually, all of these operations take a lot longer than I expect:


Turn Passcode On
Turn Passcode Off
Change Passcode


I'm not complaining. I'm a developer (not Apple tech) who thinks it takes longer than it ought to basically hash a few bytes and write to an SSD. I assume that's because the work involved in managing an iOS password is either more complicated than I imagine, or it's some kind of anti-cracking countermeasure. The more I wonder about it, the more curious I am about the details. Is it some kind of cool cryptography thing??

Does anyone know anything about this? What actually happens when I disable passcode-to-unlock behavior on an iPhone?
As another answer pointed out, iOS 8 uses FDE with passcode enabled, much the same way FileVault encrypts a hard drive on a Mac. The more data you have, the longer it will take to de-crypt or re-encrypt all this stuff as you toggle it. 

The secondary reason for this is by design: Mac OS and iOS have strong UNIX and BSD underpinnings, as most are aware (side note: how cool is it iOS auto-fills 'underpinnings' after I type 'UNIX'?!). UNIX systems implement a computationally expensive hashing algorithm, which is designed to resist brute-force attacks because it takes so damn long. While the effectiveness of this technique has waned as processors become faster and more powerful, it's still noticeable as the little spinny thing on your login screen just before you log in to your Mac, which would make sitting there and typing random passwords very annoying (read up on pam_unix if this interests the developer side of your brain).