The "s2k" options correspond to the String-to-Key specifiers. An s2k transform turns a human-compatible symmetric secret (a password or passphrase) into a symmetric key suitable for a symmetric encryption or MAC algorithm.
Turning passwords into keys is tricky business because passwords that human can remember and accept to type tend to be weak with regards to exhaustive search (often called "dictionary attacks" in that context, since we are talking about words). Thus, we need a "strengthened" process which is often called "password hashing" or "password-based key derivation". To be brief, a good password hashing process must:
be unique to each case, to prevent precomputations and cost sharing;
be awfully expensive, in a configurable way.
Read this answer for an introduction to the relevant concepts of password hashing.
The s2k-count
parameter is used only when the s2k method is "3", i.e. Iterated and Salted S2K in OpenPGP terminology. This password hashing method basically hashes together multiple copies of the salt and the password, concatenated, until the total byte count reaches the specified value. With the maximum value (65011712), about 65 MB worth of data are thus hashed; a modern machine (even a "small" one like a smartphone) should be able to do that in a fraction of a second (say, less than half a second), so this is tolerable from a user interface point of view. However, the attacker will also need to do that heavy hashing for each trial of a potential password; and for him, there is a huge difference between half a second and a millionth of a second, because he has many potential passwords to try.
Now that S2K is not the best in town, because smart attackers will get a substantial boost in their attack by using some GPU (GPU are very good at running hash functions like SHA-1). But this is the best one defined so far in the OpenPGP format.
The --s2k-cipher-algo
is about informing the S2K transform about the kind of key it must produce: while symmetric keys are mostly bunches of bits, their length still depends on the intended algorithm (e.g. a key for AES-256 must have 256 bits in length).
man gpg
is confusing / unclear about these options? $\endgroup$ – puzzlepalace Jul 6 '17 at 19:00--s2k-count n
pretty clearly answers questions 2 through 4... $\endgroup$ – puzzlepalace Jul 6 '17 at 19:01