An ancient Norse code which has been puzzling experts for years has been cracked by a Norwegian runologist - to discover the Viking equivalent of playful text messages.

The mysterious jötunvillur code, which dates to 12th or 13th-century Scandinavia, has been unravelled by K Jonas Nordby from the University of Oslo, after he studied a 13th-century stick on which two men, Sigurd and Lavrans, had carved their name in both code and in standard runes. The jötunvillur code is found on only nine inscriptions, from different parts of Scandinavia, and has never been interpreted before.

"The thing that solved it for me was seeing these two old Norse names, Sigurd and Lavrans, and after each of them was this combination of runes which made no sense," said Nordby, who is writing his doctorate on cryptography in runic inscriptions from the Viking Age and the Scandinavian Middle Ages. He then realised, he continued, that in jötunvillur, the rune sign is swapped for the last sound in the rune's name, so for example the "m" rune, maðr, would be written as the rune for "r".

"I thought 'wow, this is the system, this is the solution, now we can read this text," said Nordby. But the code turned out to be extremely confusing, because many runes end in the same sound, "so you have to decide which one to choose".

So far, what he calls his "Rosetta stone", which was found at Bergen wharf, is the only place in which it is possible to be sure what the jötunvillur code says, although he believes another rune stick may well have been inscribed with the name Thorstein, and another with the name Einar.

The sticks on which the code has been written, said Nordby, are "everyday objects, so you often find names on them, either because they used them to communicate that it was something they wanted to keep or sell, or for practising writing, or because they were talking about people so names occur frequently".

Many rune sticks have been excavated in Scandinavia, dating back to the 1100s and 1200s, he said. Just a few use codes, and even fewer use the jötunvillur code. "They were used to communicate, like the SMSes of the Middle Ages – they were for frequent messages which had validity in the here and now," he said. "Maybe a message to a wife, or a transaction."

One, from Sweden, uses a simpler code, using numbers to indicate runes, and is believed to say "kiss me". Another, from the Orkneys, says "these runes are written by the most skilled rune writer west of the sea"; the writer is "obviously showing off", said Nordby. Often, the code exhorts the reader to "interpret this if you can".

"The problem is, if you can't interpret the code, you can't understand you should be interpreting it, so the code itself is the obstacle," said Nordby.

He believes the codes – particularly jötunvillur – could have been used for education. "It seems more and more clear that coded runes were not for keeping secrets, not for sensitive communications such as during the second world war, or like for today's secure communications. But that actually, they were used to get to know the alphabet, or rune names," said Nordby. "What if codes were used like a game, playing with a system? With jötunvillur, you had to learn the names of runes, so I think codes were used in teaching, in learning to write and read runes."

Henrik Williams, a Swedish expert on runes from Uppsala University, hailed the discovery. "Above all, it helps us understand that there were more codes than we were aware of. Each runic inscription we interpret raises our hopes of soon being able to read more. This is pure detective work and each new method improves our chances," he told Science Nordic.

Williams agreed that the codes could have had an educational use, and were not just used for communication. "They challenged the reader, demonstrated skills, and testify to a joy in reading and writing," he said. " We come closer to the thoughts of people living at the time through understanding their codes. Nordby has made an important discovery by breaking the code."

Williams added to the Guardian: "The specific code of jötunvillur is obviously more entertaining than useful, although it brings to the fore the playfulness exhibited by many rune carvers, also an important discovery."

The author Joanne Harris, whose new novel The Gospel of Loki is set in the world of Norse mythology, also called Nordby's discovery "very, very interesting". Commenting on the Swedish rune code, she speculated that the runes could have a "magical/hidden significance; in this case, perhaps a love spell".