Re: Numeric one-way hash function

From: Andrew Swallow (am.swallow_at_eatspam.btinternet.com)
Date: 10/09/03


Date: Thu, 9 Oct 2003 00:21:39 +0000 (UTC)


"Ernst Lippe" <ernstl-at-planet-dot-nl@ignore.this> wrote in message
news:3f84175c$0$17950$48b97d01@reader22.wxs.nl...
> On Wed, 08 Oct 2003 00:07:05 +0000, Andrew Swallow wrote:
>
[snip]
>
> > The simplest way to ensure that the bar codes are
> > unique is to add a prime number to the previous
> > value. Lap round when you get to the top (or a prime
> > number near the top). Start at a weird value.
>
> Could you be more precise, I am afraid that I
> don't understand your algorithm.
> Anyhow, I can't see that your algorithm would
> be unbiased, or how it would prevent duplicates.
>

Where C, Max are prime constants and C != Max

Initialise N to a valid random number

loop
   N = N + C
   if N > Max then N = N - Max
   Print N
end loop

Andrew Swallow



Relevant Pages

  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... and Richard made it clear that he understands the order ... >> of evaluation of a for loop. ... > using strlen but using an Oalgorithm when there is a trivial O ... >> In most other languages the terminating ...
    (comp.programming)
  • Re: Efficiency questions: combined ifs and looping 4 times
    ... Choice of algorithm always has a far bigger impact in performance than ... Use sizeof before the loop, store the result in a var and use ... speaks well of PHP. ... your order of complexity analysis is off. ...
    (comp.lang.php)
  • Re: count of each word occurred
    ... > take each word in order and compare it with the rest of the list ... Another version of this algorithm takes advantage of the fact that it does ... loop over all words in the list ... a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Excel Sort() Algorithm
    ... keys by appending the original order as the lowest order element. ... 'infinite' loop. ... That's what the 1-loop algorithm I used provides and what the 3-loop ... Dim kv As Variant, pv As Variant, t As Variant ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... and Richard made it clear that he understands the order ... > of evaluation of a for loop. ... using strlen but using an Oalgorithm when there is a trivial O ... > condition is an end value and in these languages the strlen value ...
    (comp.programming)

Loading