diff options
author | Damien F. Katz <damien@apache.org> | 2008-04-20 22:27:11 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2008-04-20 22:27:11 +0000 |
commit | 7cbf6068b8214a89b75e3aa26bdb10d22e97ab90 (patch) | |
tree | b9fe23fd3c699fd188fb29cc966864e7c730f9b3 /src/couchdb/couch_util.erl | |
parent | fb5b6bbc5aa941478d700e8fb3011c2a24c4d2d4 (diff) |
Change uuid generaion to rely on crypto. Started crypto and inets application in startscript, and also couch_server_up. Fix for regression caused by accidental check-in of disabled etags.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@649988 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_util.erl')
-rw-r--r-- | src/couchdb/couch_util.erl | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/couchdb/couch_util.erl b/src/couchdb/couch_util.erl index 504a675a..94648b0d 100644 --- a/src/couchdb/couch_util.erl +++ b/src/couchdb/couch_util.erl @@ -40,7 +40,7 @@ start_link(LibDir) -> new_uuid() -> - to_hex(erlang:port_control(drv_port(), 2, <<>>)). + to_hex(binary_to_list(crypto:rand_bytes(16))). to_hex([]) -> []; @@ -57,8 +57,7 @@ to_digit(N) -> % returns a random integer rand32() -> - [A,B,C,D|_] = erlang:port_control(drv_port(), 2, <<>>), - (A bsl 24) + (B bsl 16) + (C bsl 8) + D. + crypto:rand_uniform(0, 16#100000000). % given a pathname "../foo/bar/" it gives back the fully qualified % absolute pathname. |