# How can I measure the time it takes to break a cryptographic algorithm by brute force attack?

3 ビュー (過去 30 日間)
Daniel 2023 年 1 月 30 日
コメント済み: Walter Roberson 2023 年 1 月 30 日
Now I am developing a modified cryptograpphic algorithm that can enhance the security. Finally when I make analysis I have to measure the strength. Among the security metrics the one is time that takes to breake the code by brute force attack. But I don't have any clue how to measure the time that takes to break the code by brute force attack . Anyone please.

サインインしてコメントする。

### 採用された回答

Walter Roberson 2023 年 1 月 30 日
timeit()
However unless you deliberately using a very small key, you would need to estimate the time instead of measuring it.
Algorithms are not always linear time. For example the average time to find some factor of a random integer is much much less than the time to prove that a number is prime, or to do a prime factorization when the number is the product of two large primes. So the mean() of the time to break a cryptography might potentially be considerably less than half of the worst case.
Brute force does not always mean trying all possible keys: it can mean trying all possibilities of something else related to keys (but traditionally it does not extend to techniques such as differential analysis)
##### 2 件のコメントなしを表示なしを非表示
Daniel 2023 年 1 月 30 日
Thank you Sir. So, how can I use this method - timeit() to measure the time it takes to break the code?
Walter Roberson 2023 年 1 月 30 日
t = timeit(@()YourFunction(AppropriateParameters), 0);
The effect is similar to
start = tic;
YourFunction(AppropriateParameters);
t = toc(start);
except that timeit has ways to try to measure more accurately.

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeProgramming Utilities についてさらに検索

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by