不同 PHP mcrypt 算法的速度

发布于 2024-11-04 09:25:26 字数 1405 浏览 2 评论 0原文

嘿伙计们。今天我正在测试 php mcrypt 算法。

我运行了一个测试来检查不同 mcrypt 算法的速度。

测试算法: Cast-128、Gost、Rijndael-128、Twofish、Cast-256、Loki97、Rijndael-192、Saferplus、Blowfish-compat、Des、Rijndael-256、Serpent、Xtea 、河豚、Rc2、Tripledes

测试在 ECB 模式下运行(您还可以使用:CBC、CFB、CTR、ECB、NCFB、NOFB、OFB)。

我加密了一个简单的字符串:“这是一个测试”。以下结果是 1000 次迭代的结果(结果以秒为单位)。

河豚 0.5217170715332

河豚鱼 0.46304702758789

CAST 128 0.19502091407776

CAST 256 0.28649806976318

DES 0.45267295837402

GOST 0.19383502006531

LOKI97 0.27537798881531

RC2 0.44201898574829

RIJNDAEL 128 0.2560601234436

RIJNDAEL 192 0.33414602279663

RIJNDAEL 256 0.42553782463074

SAFERPLUS 0.32848501205444

0.391037940979

三倍 0.65123796463013

两条鱼 0.27349305152893

XTEA 0.37829685211182

当然,当我们谈论安全性时,处理时间并不是最重要的事情。我只是想分享我的结果。

您使用什么 mcrypt 算法和模式,为什么? 我知道这取决于情况、安全级别等,但请举一些例子。

Hy guys. Today I was testing the php mcrypt algorithms.

I run a test to check the speed of different mcrypt algos.

Tested algorithms: Cast-128, Gost, Rijndael-128, Twofish, Cast-256, Loki97, Rijndael-192, Saferplus, Blowfish-compat, Des, Rijndael-256, Serpent, Xtea, Blowfish, Rc2, Tripledes.

The test was run in ECB mode (you also can use: CBC, CFB, CTR, ECB, NCFB, NOFB, OFB).

I encrypted a simple string: "This is a test". The following results are for 1000 iterations (results are in second).

BLOWFISH
0.5217170715332

BLOWFISH COMPAT
0.46304702758789

CAST 128
0.19502091407776

CAST 256
0.28649806976318

DES
0.45267295837402

GOST
0.19383502006531

LOKI97
0.27537798881531

RC2
0.44201898574829

RIJNDAEL 128
0.2560601234436

RIJNDAEL 192
0.33414602279663

RIJNDAEL 256
0.42553782463074

SAFERPLUS
0.32848501205444

SERPENT
0.391037940979

TRIPLEDES
0.65123796463013

TWOFISH
0.27349305152893

XTEA
0.37829685211182

Of course that process time is not the most important thing when we talk about security. I just want to share my results.

What mcrypt algo and mode are you using, and why?
I know that it depends on the situation, security level, etc. but give some examples please.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

度的依靠╰つ 2024-11-11 09:25:26

以下是 PHP(对称密码)中 MCrypt 与 OpenSSL 速度比较的完整测试基准:

mcrypt vs. openSSL benchmark

Mcrypt 较旧,但文档更好,库速度明显慢,但输出非常一致。 OpenSSL 更新、更快且文档较少。

如果您首先关心性能,那么请选择 OpenSSL CFB/ECB 256 位算法。

请注意,Intel Core i3/i5/i7 支持AES 指令集,可以将每个线程的 I/O 吞吐量从 11 MB/秒大幅提高到 700 MB/秒 - 请参阅http://en.wikipedia.org/wiki/Advanced_Encryption_Standard

Here is full test benchmark for speed comparison for MCrypt versus OpenSSL in PHP (symmetric cyphers):

mcrypt vs. openSSL benchmark

Mcrypt is older but better documented and significantly slower library, but very consistent output. OpenSSL is newer, faster and less documented.

If you care about performance in first place, then go with OpenSSL CFB/ECB 256-bit algo.

Note, that Intel Core i3/i5/i7 support AES instruction set that can extremly increase I/O throughput from 11 MB/sec to 700 MB/sec per thread - see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard.

情话难免假 2024-11-11 09:25:26

我正在使用 AES 256 (MCRYPT_RIJNDAEL_256),为什么?由于该算法的知名度和广泛使用。我还使用 CBC 模式进行加密,我不明白其确切原因,但从我从各种来源读到的内容来看,它比 ECB 更可靠(如安全)。

另外,请记住,当您处理散列和/或加密时,速度不是您的朋友(原因很简单:如果速度快,破解速度也会更快强>)。

I am using AES 256 (MCRYPT_RIJNDAEL_256), why? Because of the algorithm notoriety and widespread usage. I'm also encrypting using CBC mode, I don't understand exactly the reason why but from what I read from various sources it's much more reliable (as in secure) than ECB.

Also, keep in mind that when you're dealing with hashing and/or encryption speed is not your friend (the reason for that is simple: if it's fast, it's faster to crack).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文