App-specific part stayed (though it may move into `devices/crypto.py`, as that seems to be the place where it's used)