{"id":698,"date":"2011-02-20T21:25:33","date_gmt":"2011-02-21T01:25:33","guid":{"rendered":"http:\/\/steve.vinoski.net\/blog\/?p=698"},"modified":"2011-02-20T21:25:33","modified_gmt":"2011-02-21T01:25:33","slug":"new-erlang-sha-2-implementation","status":"publish","type":"post","link":"https:\/\/steve.vinoski.net\/blog\/2011\/02\/20\/new-erlang-sha-2-implementation\/","title":{"rendered":"New Erlang SHA-2 Implementation"},"content":{"rendered":"<p>A few years ago I wrote a pure Erlang version of the <a href=\"http:\/\/csrc.nist.gov\/publications\/fips\/fips180-3\/fips180-3_final.pdf\">SHA-2 hash algorithms (SHA-224, SHA-256, SHA-384, SHA-512)<\/a>. They were kinda slow but they worked fine, and a number of people used them.<\/p>\n<p>I&#8217;ve now rewritten the functions in a new Erlang library application named <code>erlsha2<\/code>, available at <a href=\"https:\/\/github.com\/vinoski\/erlsha2\">github<\/a>. The <code>erlsha2<\/code> implementation uses <a href=\"http:\/\/www.erlang.org\/doc\/man\/erl_nif.html\">Erlang NIFs<\/a>, making it significantly faster than the original. The original Erlang implementations are still there too, but they&#8217;re automatically overridden by the NIF library when it loads.<\/p>\n<p>Compared to the <a href=\"\/code\/sha2.erl\">original module<\/a>, the exported functions in this module have been renamed; they used to have names like <code>hexdigest224<\/code> but they now have shorter names like <code>sha224<\/code> to more closely match the Erlang <code><a href=\"http:\/\/erlang.org\/doc\/man\/crypto.html\">crypto<\/a><\/code> module. I also implemented the <code>init<\/code>\/<code>update<\/code>\/<code>final<\/code> function groups for each hash algorithm to allow data to be incrementally hashed, also to match the <code><a href=\"http:\/\/erlang.org\/doc\/man\/crypto.html\">crypto<\/a><\/code> module.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few years ago I wrote a pure Erlang version of the SHA-2 hash algorithms (SHA-224, SHA-256, SHA-384, SHA-512). They were kinda slow but they worked fine, and a number of people used them. I&#8217;ve now rewritten the functions in a new Erlang library application named erlsha2, available at github. The erlsha2 implementation uses Erlang [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,4,12],"tags":[169,140,147],"class_list":["post-698","post","type-post","status-publish","format-standard","hentry","category-code","category-erlang","category-performance","tag-code","tag-erlang","tag-performance"],"_links":{"self":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts\/698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/comments?post=698"}],"version-history":[{"count":12,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts\/698\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/posts\/698\/revisions\/710"}],"wp:attachment":[{"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/media?parent=698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/categories?post=698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/steve.vinoski.net\/blog\/wp-json\/wp\/v2\/tags?post=698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}