line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DAV::UUID; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
49320
|
use strict; |
|
18
|
|
|
|
|
42
|
|
|
18
|
|
|
|
|
798
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.304'; |
6
|
|
|
|
|
|
|
$VERSION = eval $VERSION; # convert development version into a simpler version number. |
7
|
|
|
|
|
|
|
|
8
|
18
|
|
|
18
|
|
4523
|
use Digest::SHA1 qw(sha1); |
|
18
|
|
|
|
|
8623
|
|
|
18
|
|
|
|
|
1800
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my $counter = 0; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Given a WebDAV resource path and lock requestor/owner, generate |
14
|
|
|
|
|
|
|
# a UUID mostly compliant with RFC 4918 section 20.7. Despite the |
15
|
|
|
|
|
|
|
# lack of EUI64 identifier in the host portion of the UUID, the |
16
|
|
|
|
|
|
|
# value generated is likely not cryptographically sound and should |
17
|
|
|
|
|
|
|
# not be used in production code outside of the limited realm of a |
18
|
|
|
|
|
|
|
# WebDAV server implementation. |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# Note that due to the nature of the underlying libc function rand(), |
21
|
|
|
|
|
|
|
# it would be best that any concurrent WebDAV services built upon |
22
|
|
|
|
|
|
|
# this package synchronize upon usages of this method. |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
sub generate { |
25
|
10075
|
|
|
10075
|
0
|
80768
|
return join '-', unpack('H8 H4 H4 H4 H12', sha1( join( ':', @_[0,1], time, rand, $<, $$, ++$counter ) )); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |