{"id":582,"date":"2013-03-30T09:14:54","date_gmt":"2013-03-30T16:14:54","guid":{"rendered":"https:\/\/inkofpark.wordpress.com\/?p=582"},"modified":"2013-03-30T09:14:54","modified_gmt":"2013-03-30T16:14:54","slug":"raspberry-pi-truecrypt-benchmark","status":"publish","type":"post","link":"https:\/\/www.inkofpark.com\/?p=582","title":{"rendered":"Raspberry Pi TrueCrypt Benchmark"},"content":{"rendered":"<h3><strong>Note: The results in this post have been improved with more accurate values at <a href=\"http:\/\/inkofpark.wordpress.com\/2013\/03\/31\/revised-raspberry-pi-truecrypt-benchmark\/\">Revised Raspberry Pi TrueCrypt Benchmark<\/a>.<\/strong><\/h3>\n<p>I recently acquired a Raspberry Pi model B 512 MB from the excellent people at <a href=\"https:\/\/www.adafruit.com\/\">Adafruit<\/a>. I am interested in it as a small computer for basic text processing, and am curious about its performance in consumer crypto. One part of the security of the Pi, or any modern computer, is disk encryption.<\/p>\n<p>My disk encryption of choice is TrueCrypt, mainly because it is cross-platform. That it is also free and open source is a nice benefit, though the TrueCrypt3 license may not rise to Stallman\u2019s standard. I found several posts from persons who compiled TrueCrypt on the RasPi, and it is relatively trouble free. At the bottom of the post are my notes on how I did the install and a script that performs the benchmarking.<\/p>\n<p>While I don\u2019t understand the relationship between the hashing function and the encryption function, I expected that speed would be unrelated to the hash algorithm. This was not what I experienced, as shown in the data below.<\/p>\n<p>Performance, in MB seconds, as TrueCrypt reports for initializing a 10,000,000 byte file.<\/p>\n<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td valign=\"bottom\" width=\"81\"><b>Hash<\/b><\/td>\n<td valign=\"bottom\" width=\"127\"><b>Encryption<\/b><\/td>\n<td valign=\"bottom\" width=\"51\"><b>Speed<br \/>\n(MB\/s)<\/b><\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">3.4<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">3<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">AES<\/td>\n<td valign=\"bottom\" width=\"51\">2.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">2.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">2.3<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">2.2<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">AES<\/td>\n<td valign=\"bottom\" width=\"51\">2<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">2<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.9<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">1.8<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">1.6<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">1.6<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">1.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">1.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">RIPEMD-160<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-Twofish-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.5<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.4<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">1.3<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">SHA-512<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-Twofish-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.3<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">1.3<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish<\/td>\n<td valign=\"bottom\" width=\"51\">1.2<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1.2<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">Serpent-Twofish-AES<\/td>\n<td valign=\"bottom\" width=\"51\">1<\/td>\n<\/tr>\n<tr>\n<td valign=\"bottom\" width=\"81\">Whirlpool<\/td>\n<td valign=\"bottom\" width=\"127\">AES-Twofish-Serpent<\/td>\n<td valign=\"bottom\" width=\"51\">0.934<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The upshot is that all of these are pretty slow, and all of them would be essentially unnoticeable for basic text file (or RTF) work. I wouldn\u2019t want to do image or audio processing with this encryption, but then I wouldn\u2019t want to do that on a Pi anyway.<\/p>\n<h2>Method of Speed Assessment<\/h2>\n<p>I wanted a non-interactive way to perform the test, so I wrote this script. I am relying on the data reported by the TrueCrypt volume creation process. Because TrueCrypt writes a status to the terminal it produces output that is dreadful to process, so I wrote the little python script to produce a CSV from the log.<\/p>\n<p>The test was performed with an ARMv6 compatible processor rev 7 (v61) at 464.48 BogoMIPS. The OS is Debian GNU\/Linux 7.0 (Wheezy), which was installed as the 2013-02-09-wheezy-raspbian image. I built TrueCrypt from source for 7.1a along with wxWidgets 2.8.12 (also built from source) and pkcs version 11.2.<\/p>\n<h3>Shell Script<\/h3>\n<p>#!\/bin\/bash<\/p>\n<p># Create a file of random elements, needs to be at least 300 bytes<br \/>\ndd if=\/dev\/random of=random bs=512 count=1<\/p>\n<p># Iterate over the hash hash funnctions<br \/>\nfor HASH in RIPEMD-160 SHA-512 Whirlpool<br \/>\ndo<br \/>\n# Iterate over the available encryption algorithms<br \/>\nfor ENCALG in AES Serpent Twofish AES-Twofish AES-Twofish-Serpent Serpent-AES Serpent-Twofish-AES Twofish-Serpent<br \/>\ndo<br \/>\n# Write the algorithms to the log<br \/>\necho &#8220;Algorithms: $HASH $ENCALG&#8221; &gt;&gt; log<br \/>\n# TrueCrypt will report the performance in the output<br \/>\ntruecrypt -c \/home\/pi\/test.tc &#8211;filesystem=fat &#8211;size=10485760<br \/>\n&#8211;encryption=$ENCALG -p ppp &#8211;random-source=random<br \/>\n&#8211;hash=$HASH &#8211;volume-type=normal &#8211;non-interactive &gt;&gt; log<br \/>\n# Erase the created file<br \/>\nrm test.tc<br \/>\ndone<br \/>\ndone<\/p>\n<h3>Python Reprocessor<\/h3>\n<p>import sys<br \/>\nfid = open( sys.argv[1], &#8216;r&#8217;)<br \/>\nlines = fid.readlines()<br \/>\nfid.close()<\/p>\n<p>speed = None<br \/>\nwhile len( lines) &gt; 0:<br \/>\nline = lines.pop(0)<br \/>\nlls = line.strip()<\/p>\n<p>if lls.startswith( &#8216;Algo&#8217;):<br \/>\n# If we already have a speed, then print<br \/>\n# the last elements<br \/>\ntoks = lls.split()<br \/>\nif speed == None: # first record<br \/>\nalgo = &#8220;,&#8221;.join( toks[1:3])<br \/>\nelse:<br \/>\nprint algo,&#8221;,&#8221;,speed<br \/>\nalgo = &#8220;,&#8221;.join( toks[1:3])<br \/>\nelif lls.startswith( &#8216;Done&#8217;):<br \/>\ntoks = lls.split()<br \/>\nspeed = &#8220;,&#8221;.join(toks[-5:-3])<br \/>\nprint algo,&#8221;,&#8221;,speed<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: The results in this post have been improved with more accurate values at Revised Raspberry Pi TrueCrypt Benchmark. I recently acquired a Raspberry Pi model B 512 MB from the excellent people at Adafruit. I am interested in it as a small computer for basic text processing, and am curious about its performance in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[19,26,44],"class_list":["post-582","post","type-post","status-publish","format-standard","hentry","category-making","tag-benchmark","tag-encryption","tag-raspberrypi"],"_links":{"self":[{"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=\/wp\/v2\/posts\/582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=582"}],"version-history":[{"count":0,"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=\/wp\/v2\/posts\/582\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inkofpark.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}