SM4 Explained: China’s Standard Cipher, and Why the World Watches It

SM4 explained in plain terms means understanding the cipher that China built for itself, a 128-bit block cipher that guards Chinese government, banking, and wireless networks, and that the rest of the world is watching closely. The central question is why a cipher most people have never heard of matters to anyone outside China, and the answer is that China’s digital economy is too large to ignore, and its cryptography goes with it.

SM4 is a block cipher originally published as SMS4 in 2006 by the Chinese State Cryptography Administration, built on a Feistel structure with 32 rounds and a 128-bit key. It became the Chinese national standard GB/T 32907-2016, it protects the WAPI wireless standard, and it is now supported by major cryptographic libraries around the world.

This article makes the case for understanding SM4, explains what it is, how it works, and where it already runs.

Key takeaways

  • SM4 is a 128-bit block cipher published in China in 2006.
  • It uses a Feistel structure with 32 rounds and a 128-bit key.
  • It is the Chinese national standard GB/T 32907-2016.
  • It protects the WAPI wireless standard used in China.
  • It is now supported by major cryptographic libraries worldwide.

What SM4 is

SM4 is a cipher that encrypts data in 128-bit blocks, splitting each block into four 32-bit words and processing them through a generalised Feistel network. In each round, one word passes through a round function that mixes it with the round key, substitutes its bytes, and spreads the result, and the output is combined with another word before the words rotate for the next round.

Its signature feature is the round function, which is built from a single 8-bit substitution box applied to all four bytes of a word, followed by a linear transformation that mixes the bytes together. The design is deliberately simple, using one S-box where other ciphers use several, which makes SM4 easy to implement in hardware and easy to analyse, and that simplicity is a deliberate choice rather than a shortcut.

The design was a reaction to China’s need for its own cryptography. In the mid-2000s, China wanted encryption for its wireless networks, government systems, and businesses that it could trust, audit, and control, and the State Cryptography Administration published SMS4 as the answer, first for wireless security and then as a general-purpose national standard.

It became the cipher behind WAPI, China’s wireless security standard. WAPI was China’s alternative to the Wi-Fi security standards used elsewhere, and SM4 was the cipher at its heart, which meant that every device sold for the Chinese wireless market needed to implement it, and that gave SM4 a vast installed base from the start.

Its most famous property is how far it has travelled. SM4 began as a Chinese national cipher, but it is now supported by OpenSSL, included in the Linux kernel’s cryptography framework, and defined for use in TLS, which means a cipher that started behind national borders is now part of the global cryptographic toolkit.

Our guide to AES encryption explains the global standard SM4 is most often compared with, and our guide to Serpent explains another Feistel cipher built for careful analysis.

How SM4 works

Everything starts with the four 32-bit words that make up each 128-bit block. The cipher processes the words in turns, with one word passing through the round function in each round while the others wait, then the words rotate, so that every word is transformed regularly and the influence of each word spreads across the whole block over the 32 rounds.

The round function takes a 32-bit input, XORs it with the round key, and passes each of its four bytes through the same substitution box, which replaces each byte with a different byte according to a fixed table. The substitution is what makes the cipher nonlinear, and without it an attacker could solve the whole cipher with simple algebra, so the single S-box carries a great deal of responsibility.

After substitution, the linear transformation mixes the four bytes together using rotations and XORs, which spreads the effect of each changed byte across the whole word. The transformation is designed so that a change in one input bit affects many output bits, and after enough rounds a change in one bit of the plaintext changes about half the bits of the ciphertext, which is the avalanche effect every good cipher must produce.

The key schedule expands the 128-bit master key into thirty-two 32-bit round keys, using a process that itself calls the round function. Reusing the cipher’s own components for the key schedule is an elegant choice, because it means the key expansion gets the same careful design as the encryption, and it saves space in hardware that only needs to implement the round function once.

The round count is fixed at 32, which is generous compared with most ciphers, and that generosity is deliberate. SM4’s round function is simpler than those of many ciphers, so the designers compensated with more rounds, and the cryptanalysis since 2006 has confirmed that the balance holds, with the best attacks falling well short of the full cipher.

Decryption runs the same rounds in reverse, which is the convenient property of every Feistel design. The receiver applies the round keys in the opposite order, and the plaintext comes back out, which means the same hardware and the same software can encrypt and decrypt without a second implementation.

A dark office with a glowing city skyline on a large screen, a laptop and a notebook on the desk
A dark office with a glowing city skyline on a large screen, a laptop and a notebook on the desk, shows how SM4 works: four words take turns through a single substitution box until every bit has influenced every other.

Comparing SM4 with other national ciphers

SM4 is one of several national ciphers, and each was built with a different emphasis. AES is the global standard designed through an open international competition, SEED is South Korea’s Feistel cipher that has guarded its banking since 1998, and ARIA is South Korea’s modern substitution-permutation cipher, while SM4 trades complexity for round count, and each approach trades something for something else.

The table below sets out the main contrasts between the leading approaches.

Aspect SM4 SEED AES
Block size 128 bits 128 bits 128 bits
Structure Generalised Feistel Feistel Substitution-permutation
Rounds 32 16 10 to 14
Origin China, 2006 Korea, 1998 Belgium, 1998
Best for Chinese systems Korean systems General use

The practical result is that SM4 is the right choice for Chinese systems, SEED suits Korean systems that standardised on it, and AES fits everything else.

Where SM4 is used

Chinese wireless networks use it through WAPI. Devices sold for the Chinese market that use the WAPI wireless security standard rely on SM4 to protect their connections, which means the cipher is built into phones, laptops, and access points across the world’s largest wireless market.

Chinese government systems use it for official data. Government agencies in China that handle sensitive information use SM4 as part of their approved cryptography, and the national standard behind it gives their choice a clear basis in regulation and policy.

Chinese banking and finance use it for transactions. Banks and payment systems operating in China use SM4 where Chinese standards require it, which means the cipher protects a share of the world’s largest financial market, and every transaction that passes through those systems depends on it.

Global software libraries support it for completeness. OpenSSL includes SM4, the Linux kernel’s cryptography framework includes it, and developers anywhere in the world can use it, which means a cipher that began as a national standard is now available to anyone who needs to interoperate with Chinese systems.

Businesses working with China use it to interoperate. A company that sells into China, partners with Chinese firms, or handles data under Chinese regulations needs SM4 in its toolkit, because the systems on the other side expect it, and cryptography that cannot talk to its counterpart is cryptography that does not work.

Strengths and limits

The greatest strength of SM4 is its simplicity. A round function built from one substitution box and a linear transformation is easy to implement correctly, easy to test, and easy to analyse, and the generous 32 rounds give the simple design a large safety margin that has held up under years of scrutiny.

It is also a strength that SM4 is supported globally. A cipher that runs in OpenSSL and the Linux kernel can be deployed anywhere, and that support means engineers outside China can use SM4 without building their own implementation, which lowers the barrier to interoperating with Chinese systems.

The limits are real, though, and the biggest is geography. Outside China and the businesses that work with it, almost nobody uses SM4, which means smaller communities of implementers, fewer independent reviews in recent years, and less tooling than global ciphers enjoy, and a system that must interoperate internationally will usually choose AES instead.

SM4 checklist

  • Use SM4 where Chinese standards or regulations require it.
  • Always use a proper mode of operation, never raw block encryption.
  • Use a fresh initialisation vector for every message.
  • Remember SM4 encrypts but does not authenticate on its own.
  • Add a message authentication code if tampering is a concern.
  • Test against published test vectors before shipping any implementation.
  • Keep keys random and protect them as carefully as with any cipher.
  • Plan for interoperability if your system must talk to the outside world.
  • Compare with AES for systems that do not need Chinese compliance.

Frequently asked questions

What is SM4 in simple terms?

It is a block cipher from China that encrypts 128-bit blocks using a Feistel design with 32 rounds, published in 2006 and standardised as the Chinese national cipher.

Why does China have its own cipher?

To have encryption it could trust, audit, and control, rather than depending entirely on foreign designs, and to meet the needs of its own wireless, government, and financial systems.

How is SM4 different from AES?

Both encrypt 128-bit blocks, but SM4 uses a Feistel structure with 32 rounds and a single substitution box, while AES uses a substitution-permutation structure with 10 to 14 rounds.

Is SM4 supported outside China?

Yes, it is supported by OpenSSL and the Linux kernel, and cipher suites for TLS have been defined, so anyone can use it to interoperate with Chinese systems.

What is WAPI?

It is China’s wireless security standard, an alternative to the Wi-Fi security standards used elsewhere, with SM4 as the cipher at its heart.

When should I use SM4?

When you operate in China, when Chinese standards or regulations require it, or when you must interoperate with systems that already use it.

The bottom line

SM4 explained in one line is this: the cipher China built for itself and then shared with the world, a simple, well-tested design that now guards the largest digital economy on the planet.

It is proof that a national cipher can become a global tool, and the reason it still matters is that anyone doing business with China will meet SM4 sooner or later, and it pays to understand it before that day comes.

This article is general information about how SM4 works, not advice about choosing encryption for a particular system or country.

Latest articles

Scroll to Top