[tor-bugs] #23415 [Core Tor/Tor]: sample_laplace_distribution() should take multiple random inputs

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Sep 6 00:55:42 UTC 2017


#23415: sample_laplace_distribution() should take multiple random inputs
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.2.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.8.1-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-relay, security-low, privcount,  |  Actual Points:
  031-backport, 030-backport, 029-backport, 028  |
  -backport-maybe, 026-backport-maybe            |
Parent ID:  #23061                               |         Points:  0.5
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------
Changes (by teor):

 * status:  new => needs_review


Old description:

> Currently, sample_laplace_distribution() takes a random double as input,
> and then extracts the following random values:
> * a random sign
> * a random value in (0.0, 1.0]
>
> This reduces the precision of the result. For details, see:
> https://trac.torproject.org/projects/tor/ticket/23061#comment:32
>
> Instead, the function could take a random boolean sign and p, and the
> transform becomes:
> {{
> result = mu - b * (sign ? 1.0 : -1.0)
>                 * tor_mathlog(1.0 - p);
> }}
>
> This would increase the precision by one bit, plus whatever precision is
> lost in `2.0 * fabs(p - 0.5)`.
>
> This may have been introduced in dad5eb7.

New description:

 Currently, sample_laplace_distribution() takes a random double as input,
 and then extracts the following random values:
 * a random sign
 * a random value in (0.0, 1.0]

 This reduces the precision of the result. For details, see:
 https://trac.torproject.org/projects/tor/ticket/23061#comment:32

 Instead, the function could take a random boolean sign and p, and the
 transform becomes:
 {{{
 result = mu - b * (sign ? 1.0 : -1.0)
                 * tor_mathlog(1.0 - p);
 }}}

 This would increase the precision by one bit, plus whatever precision is
 lost in `2.0 * fabs(p - 0.5)`.

 This may have been introduced in dad5eb7.

--

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23415#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list