嵌入式係統中的密碼算法性能參考(STM32F10x)

隨著物聯網的發展, 在嵌入式係統(embedded system)中使用各種密碼算法進行數據保護和身份認證逐漸成為一項基本需求. 但是, 增加密碼算法會影響嵌入式係統的性能嗎? 會影響到什麼程度? 我應該選擇什麼樣的密碼算法呢?

為了回答上麵的問題, 我們首先從在IoT中使用較為廣泛的STM32係列CPU開始, 移植各類密碼算法, 並將主要算法性能發布在這裏, 供各位參考.

STM32F107ZE@72MHZ
Flash: 512KB
RAM: 64KB

AES      25 kB  0.052 seconds,    0.466 MB/s
Camellia 25 kB  0.048 seconds,    0.513 MB/s
ARC4     25 kB  0.010 seconds,    2.511 MB/s
RABBIT   25 kB  0.019 seconds,    1.259 MB/s
3DES     25 kB  0.242 seconds,    0.101 MB/s
SM4      25 kB  0.076 seconds,    0.320 MB/s
ZUC      25 kB  0.035 seconds,    0.702 MB/s

MD5      25 kB  0.010 seconds,    2.548 MB/s
SHA      25 kB  0.015 seconds,    1.666 MB/s
SHA-256  25 kB  0.029 seconds,    0.854 MB/s
SHA-384  25 kB  0.073 seconds,    0.335 MB/s
SHA-512  25 kB  0.078 seconds,    0.313 MB/s
SM3      25 kB  0.041 seconds,    0.590 MB/s

RSA 2048 public encryption      255.043 milliseconds,  3.92/s
RSA 2048 private decryption     2619.672 milliseconds,  0.38/s
RSA 2048 sign   2619.346 milliseconds,  0.38/s
RSA 2048 verify 254.671 milliseconds,  3.93/s

DH  2048 key generation  1008.250 milliseconds,  0.99/s
DH  2048 key agreement   1162.475 milliseconds,  0.86/s

ECC  256 key generation  419.448 milliseconds,  2.38/s
EC-DHE   key agreement   477.113 milliseconds,  2.10/s
EC-DSA   sign   time     510.192 milliseconds,  1.96/s
EC-DSA   verify time     955.580 milliseconds,  1.05/s