Memory chips of the same model, with identical serial numbers and the same price, come off the manufacturing line. But when they are powered on, each begins its unique pattern of making tiny mistakes. For years, these mistakes were a target for the engineers trying to eliminate them. However, security specialists found ways to use them for anti-counterfeit protection, securing encryption keys, and even tracing people.
Why there are different kinds of memory
The ideal memory chip should be fast, cheap, spacious, and non-volatile. None exist. Hence, computers use different types of memory chips, each of them having some advantages in particular tasks.

SRAM uses the miniature closed circuit of transistors containing two possible states for every bit - like a light switch. It is the fastest memory but requires six transistors to store one bit and, therefore, is expensive and big. SRAM is used in the cache memory and microcontrollers' memory.
DRAM stores each bit in the form of the amount of charge in the capacitor. Only one transistor and a capacitor are necessary to store one bit. Therefore, it is cheap and small enough to become the primary memory of the computer. Unfortunately, the charge stored in it leaks away with time, and the memory needs refreshing every 64 milliseconds.
Flash uses a special transistor in which the charge is trapped in the insulator. Once in there, electrons remain trapped for years, making flash a good choice for phone memory, SSDs, and USB drives. The writing and erasing process of the flash is slower than that of other memories, as erasure happens in blocks. Additionally, the erasure process damages the insulator, hence limiting the usage of the memory in several thousands of erasing cycles.
Flaws of each memory kind
Modern chip factories work with technologies on an atomic level, and atoms rarely fall in place identically each time. Therefore, one transistor may be slightly stronger than its neighbour, one capacitor - leakier, some insulator layers - thinner. The manufacturers try to hide those defects under the safe margins and make all memory chips behave alike. However, if pushed to the very limit of these margins, individual flaws will start causing flipped bits.

For instance, when an SRAM chip is powered on, it does not know what its starting state is. Powering on a cell means letting it choose the desirable state, and it always depends on which of the two sides wins, the winning side being a bit stronger.

For DRAM, if it is disturbed somehow, it will forget its contents. Without refreshing the memory, the leakiest cells will forget their contents first. Moreover, in DRAM, there is a more serious flaw: the reading of some rows of the memory will affect the adjacent rows, flipping the bits in the memory that was not accessed by the program. This is the infamous Rowhammer effect. In 2014,

As with DRAM, in flash memory, changing the content of one cell can affect the state of the neighbouring cells. Besides, the cells of flash memory wear out differently: some of them can be programmed after only a few writing cycles, whilst some will require many more of them.
Turning flaws into fingerprints
Now that we know the flaws of each memory type, we can force errors and pinpoint their location. This pattern of errors is different in each chip but unique to one particular chip, just like a fingerprint. Researchers call it a physical unclonable function since even the manufacturer will not be able to create another chip with the same fingerprint pattern.

Turn on an SRAM chip and read its content right after. Most of the cells wake up identically each time, creating the long series of ones and zeros that are unique to this one chip. Comparison of two power-ups of the same chip shows that differences occur in

For DRAM chips, the easiest way is to write some pattern into the memory, interrupt its refresh, and see which cells forget the content. The set of forgetful cells is a fingerprint. This method works without any additional hardware but takes minutes. A more sophisticated way is to read the memory with deliberately quick timing, and the cells that cannot cope will show up in about

Rowhammer provides another approach. In a

For flash, under normal operation, a flash memory chip continues pulsing the cell until its contents are safely stored. Fingerprinting involves stopping this process halfway. Apply the same number of short pulses to all the cells and stop - some fast cells will be ready, but the slow ones will still be blank. This pattern of fast and slow cells becomes the unique fingerprint of a chip. The opposite technique of stopping an erase halfway through works in the reverse direction and even for the flash memory integrated into everyday microcontrollers. Everything happens using the usual chip interface, without any special equipment.
Practical use of fingerprints

Those fingerprints can be used as keys that are never stored on the chip. If a secret key is stored in a chip, it can be recovered by an attacker. However, the key derived from the chip fingerprint is different. It is generated each time the device is powered on with error correction, and it vanishes when the power goes off. There is nothing to steal from the powered-off device.

Another useful application is proving the identity. Manufacturers record the fingerprints of each chip in the factory. Then the server challenges the device to reproduce its fingerprint. This way, even affordable sensors and smart tags get a strong identity without additional security chips.
Similarly, counterfeit and recycled components can be detected. Used chips from electronic waste are regularly sold as new. Fingerprint verification will detect a chip not registered by the legitimate manufacturer, whilst analysis of the flash memory will provide even more information. Since the erasure operations take more time with ageing of the memory cells, the time it takes to execute these operations alone will indicate the remaining service life of the microchip.

Fingerprints can also be used to fight against fraud. Software-based identifiers like cookies can be deleted in seconds. Memory fingerprints survive full reinstallation of the operating system, enabling online services to detect devices used for fraudulent activities multiple times.

And finally, random numbers. The cells that fail to settle in the single state have another useful property - they generate true random numbers, which are always needed by cryptography.
The other side of the sword
However, despite having many useful applications, hardware fingerprints can also be used to track devices, and not always for good purposes. The fingerprint that cannot be changed is a fingerprint that cannot be hidden. One study showed that energy-efficient memory that tolerates minor errors produces enough errors to identify the machine that created a file. Moreover, extracting fingerprints is hard on hardware: Rowhammer attacks damage data, and flash-based approaches consume a part of the chip's lifespan.
However, the main idea of all this remains quite positive. Flaws that engineers tried to eliminate during fifty years turned out to be one of the most reliable features of the chip - the identity based on physics, chosen by no one and impossible to copy.
A huge thanks to Iona Watt for her help in editing this article.