Wiktionary says that cypher comes from Old French cyfre, which itself comes from Arabic. But ph is usually a transliteration of Greek phi. So how does it get into a French word?
A blog entry by linguist Anatoly Liberman offers some insight into these and other "anomalous" spellings involving ph:
Along with so many other learned spellings, ph appeared in English during the Renaissance. The digraph made sense (I am not saying “was needed”; it just made sense) in Greek words like orphan and physician and perhaps in names like Philip. But the scribes of that epoch inherited from their medieval predecessors the pernicious belief that the more letters one wrote in a word, the more the reader would be impressed. The easiest trick was to double consonants (and they doubled like a house on fire), but ph served their purpose too. So turph ‘turf’ and other monsters began to embellish manuscripts and books. The emergence of ph, apart from complicating spelling, introduced a good deal of confusion. For example, Anglo-French Estevene became Stephen (Greek Stephanos), while the shorter form and the family name (Steve, Stevenson) have v. However, don’t expect logic from English; Stephanie is spelled with ph and pronounced accordingly.
In short, one must chalk it up to the absurdities of prescriptive spelling and pronunciation.
It’s because medieval Latin sometimes used ciphra. The OED says of the word cipher, also spelt cypher, that
Etymology: a. OFr. cyfre, cyffre (mod.Fr. chiffre) = Sp. Pg. Ital. cifra, med.L. cifra, cifera, ciphra, f. Arab. çifr the arithmetical symbol ‘zero’ or ‘nought’ , a subst. use of the adj. çifr ‘empty, void’, f. çafara to be empty. The Arabic was simply a translation of the Sanscrit name śūnya, literally ‘empty’.
The earliest citations have it with a ph, and it has virtually never been spelt with an f in English. With numbers representing centuries (e.g., 4 means 14th century), the recorded forms in English are:
- 4 sipher, -re
- 6 cyfer, -re, cifer, -ra, -re, ciphre, -ra, sypher, -re, ziphre, (scypher)
- 6-7 cyphar
- 7 cyphre, ciphar, zifer
- 6- cypher, cipher
The OED provides no citation for the zifer spelling from the 17th century. Here are its earliest citations:
- 1399 Langl. Rich. Redeles iv. 53 ― Than satte summe, as siphre doth in awgrym, That noteth a place, and no thing availith.
- C. 1400 Test. Love ii. (1560) 286 b/1 ― Although a sipher in augrim have no might in signification of it selve, yet he yeveth power in signification to other.
- 1547 J. Harrison Exhort. Scottes 229 ― Our presidentes··doo serue but as Cyphers in Algorisme, to fill the place.
- A. 1593 H. Smith Serm. (1622) 310 ― You are··like cyphers, which supply a place, but signifie nothing.
- 1611 Shaks. Wint. T. i. ii. 6 ― Like a Cypher (Yet standing in rich place) I multiply With one we thanke you, many thousands moe, That goe before it.
- 1660 Milton Free Commw. 429 ― Only like a great Cypher set to no purpose before a long row of other significant Figures.
Personally, I am always flipflopping on the i spelling versus the y spelling, since I am always write cypher and then arguing with the spell-checkers. It appears that cypher is now in the minority, and has been for quite a while:
Apparently cypher is a bit common in the British corpus:
than it is in the American corpus:
So it appears that the cypher to cipher ratio is about 1:3 in the UK but closer to 1:16 in the US.