Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: How to generate a UUID? (was possible data format... Re:Re: dbms3.r

From: joel:neely:fedex at: 16-Jan-2002 19:48

Hi, Gregg, Gregg Irwin wrote:
> Hi Pekr, > > << checksum/secure .... :-) >> > > I don't know if "cryptographically secure" equates to > "universally unique", but I'd be glad if it did. :) >
Absent documentation, who knows (?), but not likely. By the pigeonhole principle, any function that returns fixed-length output from variable-length input (where length of input can be longer than length of output) MUST map multiple inputs to the same output. The phrase "cryptographically secure" normally implies that the output effectively randomizes the input, and it is hard to invert. I just ran CHECKSUM/SECURE on REBOL source files that were 971 bytes, 158 bytes, and 1116 bytes long and got a 20-byte result for each. Since there are only 2**160 possible 20-byte values, feeding large numbers of large inputs is guaranteed to produce duplicate outputs. (Of course, you'll need a fast CPU... ;-) -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;