0
$\begingroup$

I am trying to compare various encryption algorithms in terms of encryption duration, decryption duration, information entropy, NPCR, UACI, and correlation coefficients.

I used a Lena 256x256 grayscale PNG image as the test image, and ran my Python code on macOS X with an i7 CPU and 8 GiB RAM. I found and used implementations of DES, AES, Simon, Speck, TEA, and XTEA from PyPI, and KATAN and LEA implementations from GitHub.

Import statements indicating libraries:

from tea_encrypt import EncryptStr, DecryptStr
from speck import SpeckCipher
from simon import SimonCipher
from xtea import *
from Crypto.Cipher import AES
from Crypto.Cipher import DES

Resulting in:

Alg. En. durr. De. durr. Ent. NPCR UACI H.CC V.CC D.CC
des 1.0261 0.9338 7.9973 0.0122 0.0031 -0.0004 0.0099 -0.0064
aes 0.5620 0.4911 7.9973 0.0244 0.0101 0.0187 0.0042 -0.0043
katan 2152.3804 2248.2334 7.9977 0.0122 0.0026 0.0002 0.0156 -0.0033
speck 153.3481 175.8376 7.9967 0.0244 0.0088 -0.0111 -0.0019 -0.0210
simon 316.7725 317.3580 7.9973 0.0244 0.0082 0.0111 0.0009 -0.0210
teaX 477.2510 398.1741 7.9969 0.015 0.0000 -0.0056 0.0124 -0.0117
tea 43.7451 45.8320 7.9954 99.2567 33.3407 -0.0050 -0.0121 -0.0129
lea 6761.5435 6721.6113 7.9970 99.6323 33.4440 0.0047 0.0147 -0.0080

Legend:

  • Encryption and decryption duration displayed in milliseconds
  • NPCR: (Number of) Pixel Changing Rate
  • AUCI: Unified Average Changing Intensity

How could AES and DES be the fastest algorithms compared to other lightweight algorithms? I was expecting them to be the slowest ones. For 256x256 byte data, AES encryption duration is around 0.5 milliseconds – is this normal?

Apart from TEA and LEA, why are NPCR and UACI values near zero? For a successful algorithm, NPCR must be over 99, and UACI must be around 33.33. If an algorithm does not satisfy these criteria, they are considered fragile.

$\endgroup$
6
  • 1
    $\begingroup$ AES has Hardware support and is called AES-NI. You can see here Changing an Encryption scheme from AES to ChaCha20 the drop of speed like 1 to 10 if you turn off the hardware support in OpenSSL. And the speed was one of the factors of RijnDael to be AES. $\endgroup$
    – kelalaka
    Commented Jan 1 at 19:20
  • 1
    $\begingroup$ Of course, later ciphers like chacha use machine instructions-friendly designs, You can see that ChaCha20 with Poly1305 is much faster than AES in software. $\endgroup$
    – kelalaka
    Commented Jan 1 at 19:24
  • 6
    $\begingroup$ You are not timing algorithms. You are timing implementations of algorithms. Two implementations of AES can vary in speed easily by a factor of a million, if you compare an AES-NI version and some python implementations. NPCR and UACI are not interesting metrics when it comes to digital encryption with standard crypto algorithms like DES, AES, SPECK, SIMON, TEA (they matter only to image encryption by analog means). The different results you get for DES and TEA for NPCR and UACI only show there is a methodology error for DEs or TEA. $\endgroup$
    – fgrieu
    Commented Jan 1 at 19:26
  • $\begingroup$ thank you guys. in this situation i have two questions; first one, is there a way to run these algorithms for image encryption considering NPCR, UACI, cropping attacks etc in python? and second one, is there a way to run these algorithms especially AES and DES software based implementation in python? $\endgroup$
    – ysnky
    Commented Jan 2 at 20:53
  • $\begingroup$ Yes and yes. But I'll leave it up to you to find the sw implementations, this is not Software Recommendations (and I'm not sure if it is on topic there, mind you). $\endgroup$
    – Maarten Bodewes
    Commented Jan 3 at 15:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.