http://svn.coderepos.org/share/lang/perl/Crypt-OpenSSL-RC4/trunk/
ときどき不意に RC4 で暗号化したくなるときがあるとおもうんですが、そんなときのために Crypt::OpenSSL::RC4 を書いてみました。Crypt::RC4 という PurePerl ですごく遅い実装と、Crypt::RC4::XS という XS つかった速い実装とが、すでにあるので、激しく車輪の再発明なんですが、openssl の libcrypto つかってるあたりがお茶目です。
ちなみに適当なベンチマークの結果は下記のとおり(バージョンはすべて現在での最新版)。XS 版よりも OpenSSL の方がちょっとはやいかも。
Benchmark: timing 10000 iterations of openssl, pp, xs...
openssl: 0 wallclock secs ( 0.12 usr + 0.00 sys = 0.12 CPU) @ 83333.33/s (n=10000)
(warning: too few iterations for a reliable count)
pp: 14 wallclock secs (14.23 usr + 0.00 sys = 14.23 CPU) @ 702.74/s (n=10000)
xs: 0 wallclock secs ( 0.18 usr + 0.00 sys = 0.18 CPU) @ 55555.56/s (n=10000)
(warning: too few iterations for a reliable count)
Benchmark: timing 300000 iterations of openssl, xs...
openssl: 2 wallclock secs ( 3.58 usr + 0.00 sys = 3.58 CPU) @ 83798.88/s (n=300000)
xs: 6 wallclock secs ( 5.34 usr + 0.00 sys = 5.34 CPU) @ 56179.78/s (n=300000)http://svn.coderepos.org/share/lang/perl/Crypt-OpenSSL-RC4/trunk/author/benchmark.pl