1 package body fnd_concurrent_file as
2 /* $Header: AFCPFIDB.pls 115.2 99/08/08 20:19:53 porting ship $ */
3 function get_file_id return varchar2
4 is
5 fuid number;
6 fcrc number;
7 frand number;
8 fid number;
9 rval varchar2(32);
10 rtemp varchar2(32);
11 begin
12
13 select fnd_s_file_temp_id.nextval
14 into fuid
15 from dual;
16
17 -- Get a random number
18 fnd_random_pkg.init(7);
19 fnd_random_pkg.seed(to_number(to_char(sysdate, 'JSSSSS')), 10, false);
20 frand := fnd_random_pkg.get_next;
21
22 -- Compute CRC32 of the random number and the sequence number,
23 -- this creates a self-checking value.
24 rval := lpad(to_char(frand),10,'0')||lpad(to_char(fuid),10,'0');
25 fcrc := fnd_hash_pkg.crc32(rval);
26
27 -- XOR the sequence and random values with whatever we have
28 -- lying around. This make our algorithm more obscure,
29 -- since sequence values and pseudorandom numbers are no longer
30 -- obvious to an observer.
31 fuid := fnd_hash_pkg.xor32(fuid, frand);
32 frand := fnd_hash_pkg.xor32(fcrc, frand);
33
34 -- this value will be unique
35 fid := fcrc * power(2,64) + frand * power(2,32) + fuid;
36
37 -- base 64
38 rval := fnd_code_pkg.base64(fid, 16);
39 rtemp := rval;
40
41 -- and finally encrypt it all with RC4...actually we now use CRC Hash
42 -- rval := fnd_crypt_pkg.encrypt('4237533241', rval, 16);
43 rval := to_char(icx_call.CRCHASH('4237533241',rval));
44 return rval;
45
46 end get_file_id;
47
48 end;