[erlang-questions] Use of uuidgen with a mnesia application

Andy Gross <>
Fri Jun 6 17:25:32 CEST 2008


You can also use the following method for generating unique identifiers:

1> crypto:start().
ok
2> <<I:160/integer>> = crypto:sha(term_to_binary({make_ref(), now()})).
<41,13,88,29,5,111,251,80,169,13,157,98,38,200,99,138,10,
  166,160,63>>
3> UUIDString = erlang:integer_to_list(I, 16).
"4EDB9BAAB77AF8612C14390672C9D9B9BFB3F32A"
4>

- Andy

On Jun 6, 2008, at 11:12 AM, Paul Fisher wrote:

> On Fri, 2008-06-06 at 17:06 +0200, Alexander Lamb wrote:
>> I see, but it means you wrote a piece of code in C (probably) to call
>> uuid on the underlying system?
>>
>> (maybe it's the word "drive" that I didn't fully understand.
>
> Yes, a linked-in erlang driver, written in C.  Once you write the  
> first
> one it is not so bad after that.
>
>
> --
> paul
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions




More information about the erlang-questions mailing list