[erlang-questions] binary to bigint?

Bob Ippolito bob@REDACTED
Tue Aug 7 15:47:03 CEST 2007


1> Bin2Int = fun (Bin) -> L = 8 * size(Bin), <<Int:L>> = Bin, Int end.
#Fun<erl_eval.6.49591080>
2> crypto:start().
ok
3> Bin2Int(crypto:rand_bytes(40)).
627266637011650447231137234977838010396277839317351827811606595385624201947967310123742917146068

-bob

On 8/6/07, Jim McCoy <jim.mccoy@REDACTED> wrote:
> After bouncing through the various bits of doc related to io_lib I
> can't quite seem to put together a quick function that will convert an
> arbitrary binary to a big int (e.g. I want the integer for
> crypto:rand_bytes(40)...)
>
> Any hints?
>
> jim
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list