воскресенье, 28 августа 2011 г.

botan vs crypto++

а вот например собрал давеча на vs2010 под 64битную windows7 две криптолибы с целью померить их производительность и победителя заюзать во всяких своих прожектах

Сборка

Как это в open-source принято, без напильника военного образца ни одна либа из коробки под windows не собирается

botan 1.10.1

Например поскольку у меня установлен python 3.2.1, нужно в configure.py заменить все конструкции вида
except OSError, e: на except OSError as e:
после чего под администратором (иначе оно не может симлинки создать) запустить python configure.py --enable-sse2 --enable-ssse3

crypto++ 5.6.1

Отчего-то после конвертации их студийного проекта не подцепились два файла на asm. Можно было заморочиться и сделать все как положено, но поскольку я ленив - достаточно запустить ml64 вручную и получившиеся .obj файлы добавить в нужные проекты

Результаты

мегабайты в секунду

botan 1.10.1


AES-128 [simd] 68.42 [core] 44.88
AES-192 [simd] 56.62 [core] 38.48
AES-256 [simd] 48.32 [core] 33.38
Blowfish [core] 23.94
CAST-128 [core] 21.99
CAST-256 [core] 19.23
DES [core] 12.56
DESX [core] 12.09
GOST [core] 12.08
IDEA [simd] 81.07 [core] 14.78
KASUMI [core] 13.86
MARS [core] 30.88
MISTY1 [core] 19.40
Noekeon [simd] 63.46 [core] 17.90
RC2 [core] 10.87
RC5(12) [core] 54.26
RC5(16) [core] 40.32
RC6 [core] 41.62
SAFER-SK(10) [core] 20.86
SEED [core] 15.91
Serpent [simd] 47.85 [core] 15.21
Skipjack [core] 8.98
Square [core] 57.23
TEA [core] 14.18
TripleDES [core] 4.52
Twofish [core] 33.56
XTEA [simd] 88.13 [core] 29.50
Cascade(Serpent,AES-128) [core] 28.12
Lion(SHA-256,Salsa20,8192) [core] 17.89
Luby-Rackoff(SHA-512) [core] 10.14
TripleDES/CBC/PKCS7 [core] 4.37
TripleDES/CBC/CTS [core] 4.33
TripleDES/CTR-BE [core] 4.50
TripleDES/EAX [core] 2.23
TripleDES/OFB [core] 4.43
TripleDES/CFB(64) [core] 4.26
TripleDES/CFB(32) [core] 2.09
TripleDES/CFB(16) [core] 1.04
TripleDES/CFB(8) [core] 0.52
AES-128/CBC/PKCS7 [core] 49.88
AES-128/CBC/CTS [core] 47.33
AES-128/CTR-BE [core] 65.02
AES-128/EAX [core] 29.19
AES-128/OFB [core] 56.47
AES-128/XTS [core] 40.54
AES-128/CFB(128) [core] 44.85
AES-128/CFB(64) [core] 19.25
AES-128/CFB(32) [core] 8.47
AES-128/CFB(16) [core] 4.17
AES-128/CFB(8) [core] 2.07
Serpent/CBC/PKCS7 [core] 14.11
Serpent/CBC/CTS [core] 14.02
Serpent/CTR-BE [core] 45.91
Serpent/EAX [core] 11.01
Serpent/OFB [core] 14.61
Serpent/XTS [core] 33.61
Serpent/CFB(128) [core] 13.76
Serpent/CFB(64) [core] 6.53
Serpent/CFB(32) [core] 3.09
Serpent/CFB(16) [core] 1.54
Serpent/CFB(8) [core] 0.77
ARC4 [core] 49.21
Salsa20 [core] 74.48
Turing [core] 149.08
WiderWake4+1-BE [core] 209.10
Adler32 [core] 656.12
CRC24 [core] 74.75
CRC32 [core] 83.21
BMW-512 [core] 113.62
GOST-34.11 [core] 6.59
HAS-160 [core] 84.76
Keccak-1600(224) [core] 39.77
Keccak-1600(256) [core] 37.51
Keccak-1600(384) [core] 29.08
Keccak-1600(512) [core] 20.37
MD2 [core] 1.12
MD4 [core] 138.86
MD5 [core] 86.21
RIPEMD-128 [core] 85.63
RIPEMD-160 [core] 57.86
SHA-160 [simd] 93.22 [core] 56.56
SHA-256 [core] 35.17
SHA-384 [core] 52.96
SHA-512 [core] 52.91
Skein-512 [core] 55.95
Tiger [core] 59.04
Whirlpool [core] 22.45
CMAC(AES-128) [core] 52.82
HMAC(SHA-1) [core] 92.48
X9.19-MAC [core] 11.97

crypto++ 5.6.1

AlgorithmMiB/SecondMicroseconds to
Setup Key and IV

AES/GCM572.758
AES/CCM291.690
AES/EAX293.312
GMAC(AES)3492.789
VMAC(AES)-6416415.757
VMAC(AES)-1289126.829
HMAC(SHA-1)771.097
Two-Track-MAC370.060
CMAC(AES)511.300
DMAC(AES)513.301
CRC32101
Adler32566
MD585
SHA-177
SHA-25643
SHA-51255
Tiger101
Whirlpool22
RIPEMD-16037
RIPEMD-32042
RIPEMD-12854
RIPEMD-25662
Panama-LE3573.575
Panama-BE2285.001
Salsa201870.737
Salsa20/122980.894
Salsa20/84210.903
Sosemanuk3092.415
MARC4956.782
SEAL-3.0-LE164133.301
WAKE-OFB-LE767.335
AES/CTR (128-bit key)681.458
AES/CTR (192-bit key)551.461
AES/CTR (256-bit key)481.582
AES/CBC (128-bit key)521.211
AES/CBC (192-bit key)451.214
AES/CBC (256-bit key)391.340
AES/OFB (128-bit key)491.415
AES/CFB (128-bit key)511.919
AES/ECB (128-bit key)540.545
Camellia/CTR (128-bit key)261.182
Camellia/CTR (256-bit key)201.283
Twofish/CTR3016.489
Serpent/CTR152.347
CAST-256/CTR196.782
RC6/CTR3911.931
MARS/CTR216.602
SHACAL-2/CTR (128-bit key)261.719
SHACAL-2/CTR (512-bit key)261.746
DES/CTR1411.126
DES-XEX3/CTR1311.253
DES-EDE3/CTR542.521
IDEA/CTR181.389
RC5 (r=16)459.902
Blowfish/CTR22175.130
TEA/CTR131.246
XTEA/CTR141.260
CAST-128/CTR211.875
SKIPJACK/CTR86.558
SEED/CTR (1/2 K table)121.489
ECIES over GF(p) 256 Encryption6.42
ECIES over GF(p) 256 Encryption with precomputation5.00
ECIES over GF(p) 256 Decryption4.55
ECDSA over GF(p) 256 Signature3.26
ECDSA over GF(p) 256 Signature with precomputation2.58
ECDSA over GF(p) 256 Verification11.14
ECDSA over GF(p) 256 Verification with precomputation4.30
ECDHC over GF(p) 256 Key-Pair Generation3.22
ECDHC over GF(p) 256 Key-Pair Generation with precomputation2.52
ECDHC over GF(p) 256 Key Agreement3.34
ECMQVC over GF(p) 256 Key-Pair Generation3.22
ECMQVC over GF(p) 256 Key-Pair Generation with precomputation2.50
ECMQVC over GF(p) 256 Key Agreement11.02
ECIES over GF(2^n) 233 Encryption31.21
ECIES over GF(2^n) 233 Encryption with precomputation8.52
ECIES over GF(2^n) 233 Decryption17.79
ECDSA over GF(2^n) 233 Signature15.60
ECDSA over GF(2^n) 233 Signature with precomputation4.31
ECDSA over GF(2^n) 233 Verification19.13
ECDSA over GF(2^n) 233 Verification with precomputation7.35
ECDHC over GF(2^n) 233 Key-Pair Generation15.36
ECDHC over GF(2^n) 233 Key-Pair Generation with precomputation4.26
ECDHC over GF(2^n) 233 Key Agreement15.59
ECMQVC over GF(2^n) 233 Key-Pair Generation15.84
ECMQVC over GF(2^n) 233 Key-Pair Generation with precomputation4.30
ECMQVC over GF(2^n) 233 Key Agreement19.50
Мой невооруженный взгляд видит, что простая оптимизация под SIMD дает весьма неплохой рост намолота. Для сравнения например результаты fehashmac, написанной на plain C и также собранной на vs2010:

md5: 670 msec 74.626866
md2: 28906 msec 1.729745
md4: 452 msec 110.619469
ripemd128: 1544 msec 32.383420
ripemd160: 1965 msec 25.445293
ripemd256: 1435 msec 34.843206
sha1: 1747 msec 28.620492
sha-224: 2137 msec 23.397286
sha-256: 2121 msec 23.573786
sha-384: 1575 msec 31.746032
sha-512: 1575 msec 31.746032
tiger: 670 msec 74.626866
whirlpool: 2839 msec 17.611835
gost: 4976 msec 10.048232
haval3-128: 577 msec 86.655113
haval3-160: 592 msec 84.459459
haval3-192: 592 msec 84.459459
haval3-224: 592 msec 84.459459
haval3-256: 577 msec 86.655113
haval4-128: 811 msec 61.652281
haval4-160: 795 msec 62.893082
haval4-192: 795 msec 62.893082
haval4-224: 811 msec 61.652281
haval4-256: 795 msec 62.893082
haval5-128: 998 msec 50.100200
haval5-160: 998 msec 50.100200
haval5-192: 998 msec 50.100200
haval5-224: 998 msec 50.100200
haval5-256: 998 msec 50.100200

Комментариев нет:

Отправить комментарий