<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 11, 2015 at 12:38 PM, SeanD <span dir="ltr"><<a href="mailto:seand-erlang@seand.me.uk" target="_blank">seand-erlang@seand.me.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Transferring a 200MB binary between 2 nodes on the same machine using gen_tcp is taking between 100 and 200 microseconds, whilst transferring the same binary using ssl usually takes around 3 seconds!  I'm currently using R16B01, but can happily move to a later version if this is required.</blockquote></div><br>I have a Core i7-4900MQ, which is a pretty fast Haswell core.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Using the crypto application, encrypting 200 megabytes of 0'es with aes_ctr mode, IV = 16 bytes of 0'es, key = binary:copy(<<"foobar">>, 4) (192 bit key) takes 1.7 seconds. This is going to be the lower bound of an AES stream in CTR mode. If your core is slower, then 3 seconds doesn't sound wrong.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Using the `enacl` application[0], Running 200 megabytes of 0'es through a secretbox (xsalsa20 cipher + poly1305 MAC!, it is more secure than AES-CTR) with a nonce of 24 bytes and a 256 bit secret key takes 397 milliseconds. If you had picked a sane cryptographic library, this would have been the lower limit :)</div><div class="gmail_extra"><br></div><div class="gmail_extra">Fact is, I can encrypt-then-mac 4.3 times faster than SSL can encrypt in AES-CTR mode.</div><div class="gmail_extra"><br></div><div class="gmail_extra">In any case, I don't think you are experiencing anything odd, besides slow cryptographic primitives.</div><div class="gmail_extra"><br></div><div class="gmail_extra">[0] <a href="https://github.com/jlouis/enacl">https://github.com/jlouis/enacl</a> - Full disclosure: I'm the author, and it requires OTP 17.3+ since it uses Steve Vinoski's dirty scheduler feature.</div><div class="gmail_extra"><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">J.</div>
</div></div>