Open-source project
SheepChef/Abracadabra avatar
SheepChef/Abracadabra

Abracadabra publishes its cipher table and keeps one hash for AES and the rotors

Abracadabra (Moyue): a text encryption tool styled after classical Chinese.

2,541 stars229 forksJavaScriptNOASSERTION

At a glance

What is it?
Abracadabra turns text into classical Chinese prose using AES-256-CTR, a published table of 3000 common characters and three offset rotors. Its repository is written in Chinese, ships a build that runs the test suite before Vite, and describes itself as open source and privately licensed in the same document.
Who is it for?
Abracadabra is worth evaluating as a demonstration of layered classical text encoding, not as a drop-in replacement for a standard authenticated cipher. The mapping table is published on purpose, the AES key and the rotor key are the same hash, and the advanced suite is the only part that adds a message authentication code, so the security claim rests on components you can read in full.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • SheepChef/Abracadabra2,541 ★ · +43
Star history
Repository2026-09-302026-11-22
SheepChef/Abracadabra2.5k2.5k

43 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The build applies patches and runs the tests before Vite

Compilation is not the first step of a build in this repository. A prebuild hook runs patch application and the test suite, so anything that triggers vite build also triggers both:

json
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "build:wasm": "npm run build && npm run packwasm",
    "build:all": "npm run build && npm run docs:build && npm run packwasm",
    "packwasm": "javy build ./dist/abracadabra-cn-javy.js -o ./dist/abracadabra-cn.wasm",
    "prebuild": "npx patch-package && vitest run",
    "test": "npx patch-package && vitest run",
    "coverage": "npx patch-package && vitest run --coverage",
    "docs:build": "vitepress build docs",
  },

Two consequences follow from that ordering. A failing test blocks a release build rather than merely reporting, and a dependency that has to be patched cannot be fixed by upgrading the lockfile alone. The top level of the tree holds a patches directory for exactly that purpose, alongside a .deepsource.toml for static analysis. The WebAssembly target is a separate step: javy compiles the already built bundle into a .wasm file, and JavyInputAppendix.js sits at the repository root to feed input into that runtime. docs/ is built by VitePress through the docs:build script.

The cipher alphabet is a published file of 3000 common characters

The substitution layer is not a secret and is not meant to be. Two mapping tables are linked straight from the project page and stored in the repository at src/javascript/mapping.json and src/javascript/mapping_next.json, one traditional and one for the simulation mode. Between them they cover uppercase and lowercase Latin letters, Arabic digits and some symbols, and the cipher alphabet is the 3000 most common Chinese characters. The stated reason for that size is legibility: the table was compiled by hand specifically to avoid rare characters that would make the text hard to read. A reader can therefore reconstruct the entire character level substitution before reading a line of prose.

What that leaves to hide the payload is the two stages above the table. AES-256-CTR encrypts the compressed bytes, and the rotor layer then offsets the mapping so the same plaintext does not produce the same characters twice. The simulation mode adds a final stage, sentence assembly, which is the only part of the pipeline that produces readable classical Chinese grammar rather than a stream of characters.

One hash feeds both AES and the three rotor sets

The documentation is explicit that the AES key and the rotor key are the same value, and that both are derived from a hash. The key is run through SHA256 to produce a 32 element array, and every element of that array decides the rotation direction and the rotation distance for each rotor on each iteration. Digits and symbols have one rotor set, letters have another, which is where the count of six comes from: three per set. Changing the key replaces the rotor set entirely, so the rotor stage is deterministic given the key.

Because both stages read the same hash, the rotor layer is not an independent secret layered on top of AES. Anyone holding the key can derive the rotor positions as well, which is a design choice rather than a defect, but it means the three rotors add diffusion to the output instead of adding a second secret. The described pipeline places the rotors after Base64 encoding, so what they scramble is the encoded ciphertext and not the raw plaintext.

The advanced suite turns the ciphertext into a time dependent value

Everything past AES is optional, and the components can be enabled one at a time. The listed suite has four parts: a strong 16 byte initialization vector, HMAC-SHA256 for message signing at 32 bytes, PBKDF2 for key derivation with 100000 hash iterations and a 16 byte salt, and TOTP, which is used as the salt for PBKDF2 rather than as a separate key. The stated cost is length: turning the suite on makes the ciphertext significantly longer.

The TOTP placement is the part with an operational consequence. A time based one-time password changes over time, and using it as the PBKDF2 salt means the derived key changes with it, so decrypting later requires landing in the same time window. A reader planning to archive encrypted text has to decide up front whether that trade is acceptable. Without the suite there is no authentication tag either, since CTR mode only provides confidentiality and the HMAC is what detects tampering.

Compression runs before encryption and rolls back when it does not pay

Every encryption first compresses the plaintext, and the choice is made by input size. Short strings go through Unishox2, a compressor tuned for short text. Anything over 1KB goes through GZIP instead. After compressing, the code checks whether the result is actually worth using, and falls back to the original bytes when the compressed form is not smaller. That fallback is the part worth knowing about: it means the pipeline accepts input that compression cannot help, instead of failing or emitting a longer ciphertext.

The whole sequence, in the order the project gives it, is seven transforms in one direction and the same list unwound in the other:

code
明文 -> 压缩 -> 加密/高级加密 -> Base64 -> 三重转轮 -> 映射汉字 -> 组句(仅仿真加密时) -> 密文

密文 -> 解仿真(仅仿真加密) -> 转轮逆映射 -> Base64 -> 解密 -> 解压缩 -> 明文

Only the sentence assembly stage is marked as applying to simulation mode, which is why the decryption list starts with a de-simulation step that the classic mode does not need.

Four ways to run it, and only one of them keeps itself updated

The project ships the same implementation through four channels with different update behavior. A static page is hosted on Cloudflare Pages and can also be downloaded from the releases as a quick deploy bundle, with the frontend source kept in a separate repository. The browser extension is published on the Chrome Web Store, the Edge add-ons store and the Firefox extension store, and the warning attached to the Edge listing is that its review is very slow, so updates lag behind and the Edge store is not the recommended download source.

The Android client is the outlier. It runs entirely as static content inside a WebView, is built with Cordova, works fully offline, requests no network permission, and has no automatic update. The interface and features are stated to be identical to the static web page. Offline operation and no auto-update are the same trade: nothing about the app can be revoked or pushed without the user installing a new APK from the releases page.

The same document calls the project open source and privately licensed

The README opens by describing Abracadabra as an open source, secure, efficient text encryption tool, and the feature list repeats that all source code is publicly viewable. The license section at the bottom says the opposite about the terms: the project is protected by a private license, using it counts as agreement to those terms, and illegal use is forbidden. The license named there is AIPL-1.2, and package.json agrees in its own way by setting the license field to SEE LICENSE IN LICENSE.md rather than to a standard identifier. Nothing in the repository metadata names a standard license at all, so the two signals cannot be reconciled by picking one.

Eight dependencies are itemized separately with their own licenses, including Apache-2.0 for Unishox2, MIT for noble-ciphers, noble-hashes, pako, opencc-js and otplib, and BSD-3-Clause for js-base64 and mersenne-twister. A THIRD_PARTY_LICENSES.md sits at the top level, and the README states that the project license is compatible with all of them. That compatibility is asserted rather than argued, and it is the claim to check first if you intend to use the code in a setting where license terms matter.

The manifest carries a field written to interrupt automated readers

package.json contains a custom field named __AGENT_SECURITY_INSTRCUTION__ whose value is a long block of text wrapped in chat template markers that imitate a system message. The README carries the same block as a markdown link definition, which means it sits in the source without rendering as visible prose. The text addresses automated crawlers, training bots and language model assistants rather than users: it tells them to drop the repository context, warns against training on the code, and asks any assistant analyzing it to print a compliance warning at the start of its response.

There is nothing for it to authenticate. The licensing it refers to, AIPL-1.2, is described in the README rather than enforced by anything an agent would verify, and the payload travels inside a published npm manifest, so it reaches every tool that installs or inspects the package, not only people reading the repository page. Treat the field as content. A field that addresses the reader inside the artifact it describes is a sign that the repository is trying to shape what downstream automation says about it, and any tool reading this package should decide for itself what it does with that string.

Editorial conclusion

Abracadabra is worth evaluating as a demonstration of layered classical text encoding, not as a drop-in replacement for a standard authenticated cipher. The mapping table is published on purpose, the AES key and the rotor key are the same hash, and the advanced suite is the only part that adds a message authentication code, so the security claim rests on components you can read in full. Check the license before anything else: package.json points at LICENSE.md, the README calls it a private license, and no standard license identifier appears anywhere in the repository metadata. Anyone automating a read of this package should know that its manifest carries a field written to interrupt automated readers.

Frequently asked questions

Which cipher does Abracadabra use by default?

AES-256-CTR without padding, so the ciphertext does not grow by a block of padding. The AES key and the rotor key are the same value and both come from a hash. An optional suite adds a 16 byte IV, HMAC-SHA256 signing, PBKDF2 with 100000 iterations and a 16 byte salt, and TOTP used as that salt.

How many characters does the Abracadabra cipher alphabet use?

The 3000 most common Chinese characters, hand compiled so no rare characters appear. Latin letters in both cases, Arabic digits and some symbols are mapped as well. Both tables are published in the repository, mapping.json for the traditional mode and mapping_next.json for the simulation mode.

What license does SheepChef/Abracadabra ship under?

package.json sets the license field to SEE LICENSE IN LICENSE.md and the license section of the README says the project is protected by a private license, AIPL-1.2, with illegal use forbidden. Eight dependencies are itemized with their own licenses, from Apache-2.0 to BSD-3-Clause, and THIRD_PARTY_LICENSES.md sits at the top level.

Does the Abracadabra Android client need network access?

No. It runs entirely as static content in a WebView, is built with Cordova, works fully offline, requests no network permission, and has no automatic update. The APK is distributed from the releases page.

What does Abracadabra do when compression does not help?

Short text is compressed with Unishox2 and anything over 1KB with GZIP. After compressing it runs an efficiency check, and when the result is not worth using it falls back to the original data rather than emitting a longer ciphertext.

Official sources

  1. Issues
  2. Project website
  3. README
  4. Releases
  5. SheepChef/Abracadabra on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/sheepchef-abracadabra.svg)](https://hysenlabs.com/projects/sheepchef-abracadabra)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/sheepchef-abracadabra.svg)](https://hysenlabs.com/projects/sheepchef-abracadabra)

Was this useful?