How random are TOTP codes?


Histogram of distributions. 8 is clearly higher than the rest.

I'm pretty sure that the 2FA codes generated by my bank's TOTP app have a bias towards the number 8 - because eight is an auspicious number. But is that just my stupid meaty brain noticing patterns where none exist? The TOTP algorithm uses HMAC, which in turn uses SHA-1. My aforementioned brain is not clever enough to understand how that works. Although bigger, meatier brains have assured me it is fine. What happens if I sample, say, the next 10 TOTP codes and plot how often digits appear? …

Continue reading →

Running a Shortest Splitline Algorithm on the UK - and other mapping adventures


South Western tip of England split into three.

How do you fairly split a country into electoral subdivisions? This is a difficult problem. Whatever you choose, you'll piss off someone. A politician will be annoyed that their loyal voters are no longer in their district. And voters will be annoyed that they're now lumped in with people from the wrong side of the tracks. This is a very human problem. So let's ignore all the human aspects and run an impartial and unbiased algorithm on the issue! The Splitline Algorithm is, conceptually,…

Continue reading →

Fitting 1 dimensional data into 2 dimensional space


Hilbert curves.

A few notes to myself. Let's consider a set of 1 dimensional data. For example, the alphabet: ABCDEFGHIJKLMNOPQRSTUVWXYZ What do we mean by "1 dimensional"? Consider the element "B". From there you can go left to "A" or right to "C". Left and right are the only directions you can move. You cannot go up or down from "B". There's no way to go in or out. You're trapped in a single dimension. What if we want to write the data onto a 2 dimensional space - like a bit of paper or a website. …

Continue reading →

Book Review - Race After Technology: Abolitionist Tools for the New Jim Code


A Black woman, face sorrounded by circuits, looks to the future.

From everyday apps to complex algorithms, Ruha Benjamin cuts through tech-industry hype to understand how emerging technologies can reinforce White supremacy and deepen social inequity. Benjamin argues that automation, far from being a sinister story of racist programmers scheming on the dark web, has the potential to hide, speed up, and deepen discrimination while appearing neutral and even benevolent when compared to the racism of a previous era. Presenting the concept of the “New J…

Continue reading →

How to Hypnotise an Artificial Intelligence


A book cover in the style of a 1950's pulp sci-fi novel. An AI generated set of computers are connected by wires.

Last week I attended a talk by Dr Irina Higgins from Artificial Intelligence company DeepMind. It was a fascinating look at how their AI works, and how it is trained. Terence Eden is on Mastodon@edentIf you've ever played a video game online, it is likely you've been training an Artificial Intelligence agent without realising it.Ethical?❤️ 7💬 4♻️ 020:06 - Thu 09 March 2017 Part of the problem is that AI is usually trained on massive datasets, over millions of hours. So it is hard to know exac…

Continue reading →

Use DRAKON to Generate Code from Flowcharts


It's 1986. You're working on the Russian's Buran space programme - trying to create a re-usable space vehicle which will exceed the capabilities of the American's "Space Shuttle". There's a problem. You have very complicated real-time algorithms which you need to review, improve, optimise, and then turn into code. How do you do it? Obviously, you invent DRAKON! ДРАКОН, "dragon" Backronym for "Дружелюбный Русский Алгоритмический язык, Который Обеспечивает Наглядность." Translation: "Friendl…

Continue reading →