Skip to content

Instantly share code, notes, and snippets.

@aquelemiguel
Last active June 1, 2025 21:34
Show Gist options
  • Select an option

  • Save aquelemiguel/78c22da6de7e9d5c0064567b1d543a48 to your computer and use it in GitHub Desktop.

Select an option

Save aquelemiguel/78c22da6de7e9d5c0064567b1d543a48 to your computer and use it in GitHub Desktop.
Blue Prince's vault cypher solver
const cypher = [
["pigs", "sand", "mail", "date", "head"],
["clam", "peak", "heat", "joya", "well"],
["toad", "card", "will", "tape", "legs"],
["tree", "road", "maid", "slab", "rock"],
["hand", "vase", "safe", "clay", "toes"],
];
const res = cypher.map((row) =>
row.map((word) => {
const [a, b, c, d] = [...word].map((ch) => ch.charCodeAt(0) - 96);
return String.fromCharCode(
[
(a / b - c) * d,
(a / b) * c - d,
((a - b) / c) * d,
((a - b) * c) / d,
(a * b - c) / d,
(a * b) / c - d,
]
.filter((x) => Number.isInteger(x) && x >= 1 && x <= 26)
.sort((a, b) => a - b)[0] + 96
).toUpperCase();
})
);
cypher.forEach((row, i) => {
console.log("\n", res[i].join("\t"));
console.log(row.join("\t"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment