{"id":2071,"date":"2019-02-01T10:15:14","date_gmt":"2019-02-01T10:15:14","guid":{"rendered":"https:\/\/ibex.tech\/resources\/?p=2071"},"modified":"2024-10-26T14:04:27","modified_gmt":"2024-10-26T13:04:27","slug":"encryption-algorithms","status":"publish","type":"post","link":"https:\/\/ibex.tech\/resources\/geek-area\/security\/encryption-algorithms","title":{"rendered":"Encryption Algorithms"},"content":{"rendered":"\n<p>A few notes as we come across them on various encryption algorithms.  <em>Please note this isn&#8217;t intended to be an exhaustive or detailed list of everything, you should carry out your own research before selecting an encryption algorithm, don&#8217;t just blindly rely on comments like these here, they may be wrong or out of date!<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Hashing algorithms to use<\/h4>\n\n\n\n<p>A cryptographic hash function can be used to prove that something is unchanged, they basically force a malicious user to do an impossible amount of work to fake a change they&#8217;d like to get past it.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA2<\/h5>\n\n\n\n<p>The SHA-2 family consists of six hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512\/224, SHA-512\/256.<\/p>\n\n\n\n<p>Has the advantage that is hardware-accelerated on basically any modern hardware, so usually it&#8217;s the fastest. There are well-optimized implementations and they typically run acceptably fast unless you&#8217;re dealing with really large files (e.g. hundreds of gigabytes).<\/p>\n\n\n\n<p>SHA256 is fast and gives the closest thing we have to a guarantee that even someone trying to cause a collision will not succeed.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA3 (Keccak)<\/h5>\n\n\n\n<p>A more modern hash than SHA256.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">BLAKE2<\/h5>\n\n\n\n<p>Good<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">BLAKE3<\/h5>\n\n\n\n<p>A more modern hash than SHA256.<\/p>\n\n\n\n<p>A good choice if working with huge files as it is a cryptographic hash that can run in parallel.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA1<\/h5>\n\n\n\n<p>Do not use, no longer cryptographically secure.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">MD5<\/h5>\n\n\n\n<p>Do not use, no longer cryptographically secure<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">xxhash<\/h5>\n\n\n\n<p>Do not use, not intended to be cryptographically secure.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">crc32<\/h5>\n\n\n\n<p>Do not use, not intended to be cryptographically secure.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Encryption Algorithms<\/h4>\n\n\n\n<h5 class=\"wp-block-heading\">AES<\/h5>\n\n\n\n<p>Very efficient computationally.<br>Symetric not asymetric which is better for computation power.<br>AES128 &#8211; fine at todays standards.  Used by many password apps etc<br>AES256 &#8211; VStrong<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Blowfish<\/h5>\n\n\n\n<p>Has resisted all attacks despite being quite old.  However only has a 64bit block size (give it 64bits to encrypt at a time).  This is considered too small these days.  However has a slow key setup approach which whilst computationally intensive adds more security compared to other faster key setup methods.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">MD5<\/h5>\n\n\n\n<p>MD5 is completely broken.  Widely used and used for many web SSL security certificates.  Has recently become vulnerable to attack due to weaknesses that we&#8217;re not intended by the original desingners, allowing a new form of attack whereby fake valid SSL certificates have been created appearing to have been signed by a root authority (i.e. thawte etc).<br> MD5 without a salt is easily cracked by rainbow tables.  Many password apps use it to store a hash of the users master password &#8211; without a salt its rubbish and the rainbow tables can be used to look up the source password.<br> Using with a salt removes the rainbow tables reverse engineer method and makes the hash much better.<\/p>\n\n\n\n<p>Replacements<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>For signing documents, sha2 (e. g. sha512)<\/li>\n<\/ul>\n\n\n\n<h5 class=\"wp-block-heading\">RC4 Pseudo Random<\/h5>\n\n\n\n<p>Very good pseudo random generator widely used (e.g. used for SSL)<br>A  &#8220;too-good-to-be-true&#8221; cipher.  Brilliantly simple, modifying itself slowly but just enough to thwart attacks even though it does leak information about its state.<br>Its 25 years old now but its proved to be really simple and really good with current attacks being on the periphery of practicality.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">RSA<\/h5>\n\n\n\n<p>768bits has been cracked so need to use 1024 or 2048 to be secure.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Spritz<\/h5>\n\n\n\n<p>A re-design of RC4.  Very simple to implement.  Can be done in Javascript.<br><a href=\"https:\/\/www.schneier.com\/blog\/archives\/2014\/10\/spritz_a_new_rc.html\">https:\/\/www.schneier.com\/blog\/archives\/2014\/10\/spritz_a_new_rc.html<\/a><\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA1<\/h5>\n\n\n\n<p>Was secure and a better algorithm to MD5 as long as it was salted.  However it is now broken (2020-02) and can be reliably cracked, albeit with expensive hardawre.<br>SHA-1 provides only 80 bits of security<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA2<\/h5>\n\n\n\n<p>SHA2 is the successor of SHA1.  The SHA-2 family consists of six hash functions with digests (hash values) that are 224, 256, 384 or 512 bits: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512\/224, SHA-512\/256.  It works the same way than SHA1 but is stronger and generates a longer hash.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA-256<\/h5>\n\n\n\n<p>SHA-256 is the most popular hash function in the SHA-2 family at the time of writing. It provides 128 bits of security for digital signatures and hash-only applications<br>Considered: Good although fast to carry out on GPU&#8217;s. For password hashes bcrypt is preferred as it is more costly to crack as it can&#8217;t be run more efficiently on GPU&#8217;s.<br>Hash is a one way function \u2013 it cannot be decrypted back. This makes it suitable for password validation, challenge hash authentication, anti-tamper, digital signatures.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">SHA-512<\/h5>\n\n\n\n<p>SHA-512 is the largest hash function in the SHA-2 family of hash functions. SHA-512 provides 256 bits of security to digital signatures and hash-only applications.<br>Considered: Good<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Easy To Implement Encryption Algorithms<\/h4>\n\n\n\n<p>AES is complex and big.  Steve Gibson @ Security Now has said he&#8217;s done it in assembler but you have to be really careful and even in C is hard to get right.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Spritz<\/h5>\n\n\n\n<p>A re-design of RC4 (which is brilliant). Very easy to implement in code. Can be done in Javascript.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few notes as we come across them on various encryption algorithms. Please note this isn&#8217;t intended to be an exhaustive or detailed list of everything, you should carry out your own research before selecting an encryption algorithm, don&#8217;t just blindly rely on comments like these here, they may be wrong or out of date! [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[116],"tags":[],"class_list":["post-2071","post","type-post","status-publish","format-standard","hentry","category-security"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/2071","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/comments?post=2071"}],"version-history":[{"count":7,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/2071\/revisions"}],"predecessor-version":[{"id":2862,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/2071\/revisions\/2862"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/media?parent=2071"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/categories?post=2071"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/tags?post=2071"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}