https://github.com/cerchie/caesar-decipher
Deciphers strings encoded with caesar ciphers in English. 🔑
https://github.com/cerchie/caesar-decipher
ciphers javascript node
Last synced: 3 months ago
JSON representation
Deciphers strings encoded with caesar ciphers in English. 🔑
- Host: GitHub
- URL: https://github.com/cerchie/caesar-decipher
- Owner: Cerchie
- Created: 2021-11-26T20:03:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-28T12:59:10.000Z (over 4 years ago)
- Last Synced: 2026-02-18T11:54:54.117Z (5 months ago)
- Topics: ciphers, javascript, node
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# caesar-decipher
Deciphers strings that are encoded with caesar ciphers.
To use:
First, sign up for a [DetectLanguage account](https://detectlanguage.com/documentation) for the api key you'll need.
`git clone https://github.com/Cerchie/caesar-decipher.git && cd caesar-decipher && npm install`
You'll need a .env as well with this value:
```
APIKEY={{API KEY VAL HERE}}
```
Once you've done that, insert the value of the text you want to decode where you see 'ifmmp' here:
```
detectMeaning('ifmmp').then((data) => {
console.log(data)
})
```
Then run `node app.js` to view the answer in your console.
_Limitations:_
Only works for shifts 1-26, or -1 to -26.
If you want to use it for a language other than English, you'll need to change line 28 to catch the language code of your choice:
` result[0].language === 'en' &&`
API response comes back slowly. Would appreciate suggestions for performance improvement!
### PS: If you're interested in the thought process behind this project, I wrote a [blog post](https://dev.to/cerchie/writing-a-caesar-shift-de-cipher-function-with-javascript-part-2-5df) on it!
Here's the repo where I wrote the original utility code that ENcodes this: https://github.com/Cerchie/caesar-cipher