]>
jfr.im git - irc/SurrealServices/srsv.git/blob - branches/0.5.0/SrSv/Insp/decodeUUID.pl
4 # This file is part of SurrealServices.
6 # SurrealServices is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License version 2,
8 # as published by the Free Software Foundation.
10 # SurrealServices is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with SurrealServices; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 THIS CODE IS alpha only
, and untested
. Don
't just trust it blindly.
31 return ($char =~ /[A-Z]/);
37 my $val = (ord($char) - ord('A
')) + 10;
47 my @chars = split(//, $UUID);
48 my @sidC = @chars[0..2];
49 my @uidC = @chars[3..8];
50 my $sidN = int($sidC[0]) << (4 + (6 * 2));
51 $sidN |= getBase36($sidC[1]) << (4 + (6 * 1));
52 $sidN |= getBase36($sidC[2]) << (4 + (6 * 0));
54 foreach my $char (@uidC) {
57 $uidN |= getBase36($char);
59 return (($sidN << 48) | $uidN);
62 my $int = decodeUUID('751AAAAAA
');
64 print log($int)/log(2), "\n";