# Brute force a ciphered message?

I wrote my own cipher to encrypt messages. I would like to test a sample ciphered message to see how strong it is. Are there any tools for such task either in Windows or Linux ?

-

## 2 Answers

There's no way to verify the strength of a cipher in any automated way, especially given only the ciphertext. Attacking the construction of a cipher is an inherantly intellectual process, which does not fit well to the qualities of computer analysis.

For example, I could write a cipher such that $f(m) = rand(0,n)$ where $n$ is the largest integer representable in $sizeof(m)*8$ bits, and any automated analysis would say "this is an awesome cipher", but a human would immediately realise that it's totally useless.

If you're writing your own ciphers for real usage, I have only one piece of advice: don't.

Creating your own ciphers is fun, and it can give you a learning experience if you're actually doing it based on constructions you understand, but the resulting cipher should never ever go anywhere near a production system. Experts put their ciphers through years (decades, even) of peer review before they're adopted by anyone. If your goal is to learn, do so by breaking ciphers.

-

To calculate the time to brute force, you actually just have to look at the (effective) key space. If there are $k$ different possible keys, and all of them encrypt differently¹, it takes in average about $k/2$ tries to brute-force your cipher. How long this takes then depends on the speed of your cipher (or an optimized version thereof), and the hardware resources of an attacker.

¹This seems to be trivially the case, but it isn't: While DES uses formally a 64-bit key, 8 of these bits are not used, thus the effective key size is 56 bits, which means that in average $2^{56}/2 = 2^{55}$ tries are enough for brute-force.

Of course, with home-brewn ciphers usually the best attack is not a brute-force attack, but some clever cryptanalysis, which then only needs way less time. These ciphers are then called "broken".

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 6, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9573713541030884, "perplexity_flag": "middle"}