<div dir="ltr"><div>The ETF format[1] is fairly straight forward so, performance considerations excluded, is shouldn't be too hard to code a custom encoder which creates a bijective mapping between terms and binaries.<br><br></div>A while back I worked a bit on an ETF decoder with customizable restrictions on which types to accept to decode (and which to reject); I'm sharing it[2] in case someone finds it enlightening. I found the trickier cases to be  pids, ports, references and anonymous functions.<br><br>[1]: <a href="http://erlang.org/doc/apps/erts/erl_ext_dist.html">http://erlang.org/doc/apps/erts/erl_ext_dist.html</a><br>[2]: <a href="https://github.com/g-andrade/restricted_etf/blob/master/src/restricted_etf.erl">https://github.com/g-andrade/restricted_etf/blob/master/src/restricted_etf.erl</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 7 November 2017 at 20:07, Benoit Chesneau <span dir="ltr"><<a href="mailto:bchesneau@gmail.com" target="_blank">bchesneau@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Following the recent discussion on maps ordering, I’m curious if someone has already worked on an implementation of a canonical term_to_binary/binary_to_term to be able to sign them and make sure we get the same data across the wire.<br>
<br>
Is there  any lib that does that around? For now i’m just using a canonical version of JSON but it’s pretty inefficient …<br>
<br>
- benoit<br>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Guilherme<br></div></div></div></div></div></div>
</div>