05 Jul 2019

Fintech: (re)learning public key cryptography

Cryptography is all around us and has been for millennia. The ancient Egyptians used non-standard hieroglyphs some four thousand years ago. More recently the decryption of the Nazi Enigma machine messages potentially reduced the Second World War by several years. And no doubt school children of every generation have used codes so that the teacher cannot understand a message passed from one desk to another.

Today encryption is critical not only for communications (websites, e-mail, phone data, etc) but for many aspects of finance.

At Quartic we receive regular enquiries regarding fintech: although the basics of roboadvice and blockchain are of importance (or at least of interest) to a wide audience, the mechanics of encryption are a bit more specialist.

So it was that one sunny morning my colleague Duncan and I sat down and worked through the mathematics of public key cryptography.

The fundamental idea of this messaging technique is that it is easier to multiply large numbers together than it is to factorise one. I’m sure you could work out that 103 times 79 equals 8,137. But if you start with 8,137 the reverse process is more challenging. Now try to factorise a 2,000-digit number into two 1,000-digit prime factors. Bit tricky, huh?

Although computing speed is advancing by leaps and bounds, solving such a problem is several decades away – and if this ever looks imminent, make the numbers longer!

This is in many ways the axiom of cryptography: given any speed of computing, numbers can be multiplied to give a product that is, today, impossible to factorise.

A little while ago (ok back in my Cambridge days in the 80s) I understood cryptography. It’s all to do with number theory, the study of prime numbers. Our hand-written lecture notes were all highly theoretical and algebraic – a calculator was of little use in those maths exams. Fast forward to this century, I needed to put actual numbers into a calculation: how to generate a private key, how to encrypt a numerical message, and how magically to decrypt it. It’s all to do with a strange “phi” function, which made perfect sense 30 years ago, but needed some remedial revision for me to be able to put this into practice.

Even with two-digit prime numbers the calculations were immense: we had to put a four-digit number to the power of a second four-digit number “modulo” a third four-digit number. Way beyond the capabilities of Excel, but easily done with the agile assistance of Wolfram Alpha.

Given a bit of practice I hope that when the next client enquiry comes in I’ll be able to improvise an encryption and decryption in front of a live audience. Watch this space!

Leave a Reply