Ciphey
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡
Top Related Projects
RSA attack tool (mainly for ctf) - retrieve private key from weak public key and/or uncipher data
A tool to analyze multi-byte xor cipher
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡
Quick Overview
Ciphey is an automated decryption tool that uses natural language processing and artificial intelligence to crack encrypted text. It can handle various encryption methods, including modern ciphers, classical ciphers, and encodings, making it a versatile tool for cryptanalysis and CTF challenges.
Pros
- Supports a wide range of encryption methods and encodings
- Uses AI and natural language processing for efficient decryption
- Easy to use with both command-line and API interfaces
- Actively maintained and regularly updated
Cons
- May struggle with highly complex or custom encryption methods
- Requires Python 3.7+ and several dependencies
- Can be resource-intensive for large or complex inputs
- Accuracy may vary depending on the input and encryption method
Code Examples
- Basic usage with command-line interface:
from ciphey import decrypt
result = decrypt("Khoor Zruog")
print(result)
# Output: Hello World
- Using Ciphey with custom settings:
from ciphey import decrypt
result = decrypt("SGVsbG8gV29ybGQ=", config={"language": "en", "grep": "Hello"})
print(result)
# Output: Hello World
- Decrypting a file:
from ciphey import decrypt_file
result = decrypt_file("encrypted.txt")
print(result)
# Output: Decrypted content of the file
Getting Started
To get started with Ciphey, follow these steps:
-
Install Ciphey using pip:
pip install ciphey -
Import and use Ciphey in your Python script:
from ciphey import decrypt encrypted_text = "Uif rvjdl cspxo gpy kvnqt pwfs uif mbaz eph" result = decrypt(encrypted_text) print(result) -
Alternatively, use Ciphey from the command line:
ciphey -t "Uif rvjdl cspxo gpy kvnqt pwfs uif mbaz eph"
For more advanced usage and configuration options, refer to the official documentation on the GitHub repository.
Competitor Comparisons
RSA attack tool (mainly for ctf) - retrieve private key from weak public key and/or uncipher data
Pros of RsaCtfTool
- Specialized for RSA cryptography, offering a wide range of RSA-specific attacks and tools
- Supports various input formats, including PEM, DER, and raw modulus/exponent
- Includes a comprehensive set of factorization methods and mathematical attacks
Cons of RsaCtfTool
- Limited to RSA cryptography, not suitable for other encryption types
- Requires more technical knowledge to use effectively
- May have a steeper learning curve for beginners in cryptography
Code Comparison
RsaCtfTool:
from Crypto.PublicKey import RSA
def attack(args):
tmpfile = tempfile.NamedTemporaryFile()
with open(tmpfile.name, "wb") as tmpfd:
tmpfd.write(args.publickey[0].encode("utf8"))
args.publickey = [tmpfile.name]
Ciphey:
from typing import Optional, Dict, List
@registry.register
class Caesar(Decoder[str, str]):
def decode(self, ciphertext: str) -> Optional[str]:
for i in range(26):
plaintext = self.caesar(ciphertext, i)
if self.lc.check(plaintext):
return plaintext
The code snippets show that RsaCtfTool focuses on RSA-specific operations, while Ciphey implements a more general decoding approach for various ciphers.
A tool to analyze multi-byte xor cipher
Pros of xortool
- Specialized focus on XOR cipher analysis and decryption
- Lightweight and easy to use for specific XOR-related tasks
- Includes features like known-plaintext attack and key length guessing
Cons of xortool
- Limited to XOR ciphers, unlike Ciphey's broader encryption support
- Less automated; requires more user input and decision-making
- Smaller community and less frequent updates
Code Comparison
xortool:
from xortool import xortool
xortool.main(['-c', '20', '-l', '13', 'encrypted_file'])
Ciphey:
from ciphey import decrypt
result = decrypt("encrypted_text_here")
print(result)
Key Differences
- Ciphey offers a more comprehensive approach to decryption, supporting various cipher types
- xortool is more focused and potentially faster for XOR-specific tasks
- Ciphey provides a higher level of automation, while xortool requires more user involvement
- xortool is better suited for users with specific XOR analysis needs, while Ciphey caters to a broader range of encryption challenges
Use Cases
- Choose xortool for dedicated XOR cipher analysis and when working with known-plaintext scenarios
- Opt for Ciphey when dealing with unknown encryption types or for automated decryption attempts across multiple cipher types
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡
Pros of Ciphey
- Actively maintained with regular updates
- More comprehensive cipher detection and decryption capabilities
- Larger community and contributor base
Cons of Ciphey
- Potentially slower performance due to more extensive analysis
- May have a steeper learning curve for new users
- Requires more system resources
Code Comparison
Ciphey:
from ciphey import decrypt
from ciphey.iface import Config
text = "..."
config = Config()
result = decrypt(config, text)
print(result)
Ciphey>:
from ciphey import decryptString
text = "..."
result = decryptString(text)
print(result)
The main difference in the code is that Ciphey uses a more complex configuration system, while Ciphey> offers a simpler API with a single function call. This reflects the overall design philosophy of each project, with Ciphey providing more flexibility and options, and Ciphey> focusing on ease of use.
Both projects aim to automate the process of decrypting or decoding text, but Ciphey offers a more feature-rich experience at the cost of complexity, while Ciphey> prioritizes simplicity and quick results. The choice between the two depends on the user's specific needs and level of expertise in cryptography and programming.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
â¡ï¸
Discord |
Documentation
â¬
ï¸
Project ciphey
ciphey is the next generation of decoding tools, built by the same people that brought you Ciphey.
We fully intend to replace Ciphey with ciphey.
⨠You can read more about ciphey here https://skerritt.blog/introducing-ciphey/ â¨
How to Use
The simplest way to use ciphey is to join the Discord Server, head to the #bots channel and use ciphey with $ciphey. Type $help for helpful information!
The second best way is to use cargo install ciphey and call it with ciphey.
You can also git clone this repo and run docker build . it to get an image.
Features
Some features that may interest you, and that we're proud of.
Fast
ciphey is fast. Very fast. Other decoders such as Ciphey require advance artifical intelligence to determine which path it should take to decode (whether to try Caesar next or Base64 etc).
ciphey is so fast we don't need to worry about this currently. For every 1 decode Ciphey can do, ciphey can do ~7. That's a 700% increase in speed.
Library First
There are 2 main parts to ciphey, the library and the CLI. The CLI simply uses the library which means you can build on-top of ciphey. Some features we've built are:
- A Discord Bot
- Better testing of the whole program ð
- This CLI
Decoders
ciphey currently supports 16 decoders and it is growing fast. Ciphey supports around ~50, and we are adding more everyday.
Timer
One of the big issues with Ciphey is that it could run forever. If it couldn't decode your text, you'd never know!
ciphey has a timer (built into the library and the CLI) which means it will eventually expire. The CLI defaults to 5 seconds, the Discord Bot defaults to 10 (to account for network messages being sent across).
Better Docs, Better Tests
ciphey already has ~120 tests, documentation tests (to ensure our docs are kept up to date) and we enforce documentation on all of our major components. This is beautiful.
LemmeKnow
LemmeKnow is the Rust version of PyWhat. It's 33 times faster which means we can now decode and determine whether something is an IP address or whatnot 3300% faster than in Python.
Multithreading
Ciphey did not support multi-threading, it was quite slow. ciphey supports it natively using Rayon, one of the fastest multi-threading libraries out there.
While we do not entirely see the effects of it with only 16 decoders (and them being quite fast), as we add more decoders (and slower ones) we'll see it won't affect the overall programs speed as much.
Multi level decodings
Ciphey did not support multi-level decryptions like a path of Rot13 -> Base64 -> Rot13 because it was so slow. ciphey is fast enough to support this, although we plan to turn it off eventually.
Configurable Sensitivity for Plaintext Detection
ciphey now supports configurable sensitivity levels for gibberish detection, allowing for more accurate plaintext identification across different types of encodings. Classical ciphers like Caesar use Low sensitivity to better handle English-like results, while most other decoders use Medium sensitivity by default.
This feature helps reduce false positives and negatives in plaintext detection, making ciphey more reliable across a wider range of encoded texts.
Enhanced Plaintext Detection with BERT
ciphey now offers enhanced plaintext detection using a BERT-based model from the gibberish-or-not crate. This feature:
- Increases plaintext detection accuracy by approximately 40%
- Reduces false positives and negatives when identifying plaintext
- Can be enabled during first-run setup or later with
ciphey --enable-enhanced-detection - Requires a one-time download of a 500MB AI model (requires a free Hugging Face account)
New Features
Better search algorithm
We now use A* search. This is very fast.
A* works by using a heuristic to estimate the cost of reaching the goal from the current state.
First, we ignore the heuristic for very fast decoders like Base64 and ensure we run them first each time on each node.
Then, we calculate the heuristic for the remaining decoders using cipher_identifier which can determine the probability a given string is a certain cipher.
We store previous results in a cache to avoid recalculating the same path.
We prune the search tree to avoid unnecessary calculations and keep the memory usage down if it gets too bad.
We also keep track of statistics on decoders to dynamically prioritise decoders that work better (example: caesar is popular, but Beaufort is not so Caesar will dynamically be prioritised over Beaufort)
Finally, we keep track of popular pairs. So base64 -> base64 is very popular, so we prioritise that path (among others).
Custom themes
You can now set a custom theme for ciphey. This is useful if you want to make ciphey look different.
This also helps with accessibility.
Vigenere
We now use perhaps the best algorithm for Vigenere.
It's fast, accurate and handles non-letter characters better than any other algorithm.
Better English checking
We use a qudgaram / trigram / english dict checker to calculate probability of plaintext.
We change the thresholds depending on the cipher. Example is that Caesar returns text that "looks" like english, whereas base64 does not.
As well as this, we have a database of popular regex (about 500) of api keys, mac addresses, etc.
We also have a is_password function to determine if a string is an exact password seen in a data dump.
More ciphers
- Braille
- Atbash
- Vigenere
Database
We now store statistics in a database. This is useful for seeing how ciphey is doing over time.
AI Use
We use AI for 2 things:
- The TUI is entirely vibe coded.
- I made AI spend hours researching every single CTF challenge out there. It created a list of 15,071 CTFs. It then went through every single CTF and looked for writeups. In those writeups it looked for anything related to encoding / decoding. It then created tests out of those. This enabled us to increase our testing coverage and make sure all CTF encoding / decoding challenges are solveable with this tool.
Top Related Projects
RSA attack tool (mainly for ctf) - retrieve private key from weak public key and/or uncipher data
A tool to analyze multi-byte xor cipher
⚡ Automatically decrypt encryptions without knowing the key or cipher, decode encodings, and crack hashes ⚡
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot