public inbox for [email protected]  
help / color / mirror / Atom feed
pgcrypto docs
5+ messages / 3 participants
[nested] [flat]

* pgcrypto docs
@ 2013-05-07 21:08  Miles Elam <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Miles Elam @ 2013-05-07 21:08 UTC (permalink / raw)
  To: pgsql-docs

Currently the docs show various stats on hashes per second and time needed
to find a particular key.  Unfortunately since the times are based upon a
Pentium 4 @1.5GHz, I worry that many would take the advice on that page at
face value, e.g., "more than 100/sec is too much while less than 4/sec is
too few," with a P4 in mind.

Using a first-generation Core i5 processor as a baseline, we're looking
roughly at about a 64x increase in processing power, not including any
dedicated crypto processing in hardware like their AES extensions.

The new table, simplistically adjusted by 64x is as follows.

Algorithm    Hashes/sec    For [a-z]    For [A-Za-z0-9]
--------------------------------------------
crypt-bf/8    1792    4 years    3927 years
crypt-bf/7    3648    2 years    1929 years
crypt-bf/6    7168    1 year     982 years
crypt-bf/5    13504  188 days    521 years
crypt-md5    171584    15 days    41 years
crypt-des    23221568    157.5 minutes    108 days
sha1    37774272    90 minutes    68 days
md5    150085504    22.5 minutes    17 days
--------------------------------------------

Perhaps with a more up to date dataset, users would be far less likely to
use far more turns of blowfish and be far more (read: appropriately) averse
to using schemes like md5.  After all, who wants to use a hash that can be
cracked on 2-year old mainstream consumer processors in less than half an
hour, let alone dedicated hardware with real money behind it.

Unfortunately I only have laptops, no desktops these days.  (A sign of the
times?)  So while I could re-run these benchmarks on a mobile i3, I don't
know if that is what is appropriate for this data table.

Anyway, food for thought.


Cheers,

Miles Elam


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgcrypto docs
@ 2013-05-07 22:05  Tom Lane <[email protected]>
  parent: Miles Elam <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2013-05-07 22:05 UTC (permalink / raw)
  To: Miles Elam <[email protected]>; +Cc: pgsql-docs

Miles Elam <[email protected]> writes:
> Currently the docs show various stats on hashes per second and time needed
> to find a particular key.  Unfortunately since the times are based upon a
> Pentium 4 @1.5GHz, I worry that many would take the advice on that page at
> face value, e.g., "more than 100/sec is too much while less than 4/sec is
> too few," with a P4 in mind.

It seems like this table is guaranteed to be obsolete in a few years
no matter what.  Can we get rid of it entirely?

			regards, tom lane


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgcrypto docs
@ 2013-05-07 22:47  Miles Elam <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Miles Elam @ 2013-05-07 22:47 UTC (permalink / raw)
  To: pgsql-docs

Personally I've found the relative times instructive, merely outdated.
Perhaps using md5 as a baseline and evaluating estimates relative to that
baseline?

md5 = 1
sha1 = 4
crypt-des = 7
crypt-md5 = 1,000
crypt-bf/5 = 12,500
crypt-bf/6 = 25,000
crypt-bf/7 = 50,000
crypt-bf/8 = 100,000

This way, with the caveat that performance will vary from machine to
machine, there is a sense of the relative costs of using each algorithm,
which does not change as wildly with time.  It lets people know how bad md5
and sha1 are for protecting passwords et al.  It also demonstrates that
each turn of blowfish in this module effectively doubles the time needed to
crack and halves the number of hashes one can perform.

In short, I'd hate for the baby to be thrown out with the bathwater.


Cheers,

Miles Elam



On Tue, May 7, 2013 at 3:05 PM, Tom Lane <[email protected]> wrote:

> Miles Elam <[email protected]> writes:
> > Currently the docs show various stats on hashes per second and time
> needed
> > to find a particular key.  Unfortunately since the times are based upon a
> > Pentium 4 @1.5GHz, I worry that many would take the advice on that page
> at
> > face value, e.g., "more than 100/sec is too much while less than 4/sec is
> > too few," with a P4 in mind.
>
> It seems like this table is guaranteed to be obsolete in a few years
> no matter what.  Can we get rid of it entirely?
>
>                         regards, tom lane
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgcrypto docs
@ 2013-12-04 17:42  Bruce Momjian <[email protected]>
  parent: Miles Elam <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Bruce Momjian @ 2013-12-04 17:42 UTC (permalink / raw)
  To: Miles Elam <[email protected]>; +Cc: pgsql-docs

On Tue, May  7, 2013 at 03:47:43PM -0700, Miles Elam wrote:
> Personally I've found the relative times instructive, merely outdated.  Perhaps
> using md5 as a baseline and evaluating estimates relative to that baseline?
> 
> md5 = 1
> sha1 = 4
> crypt-des = 7
> crypt-md5 = 1,000
> crypt-bf/5 = 12,500
> crypt-bf/6 = 25,000
> crypt-bf/7 = 50,000
> crypt-bf/8 = 100,000
> 
> This way, with the caveat that performance will vary from machine to machine,
> there is a sense of the relative costs of using each algorithm, which does not
> change as wildly with time.  It lets people know how bad md5 and sha1 are for
> protecting passwords et al.  It also demonstrates that each turn of blowfish in
> this module effectively doubles the time needed to crack and halves the number
> of hashes one can perform.
> 
> In short, I'd hate for the baby to be thrown out with the bathwater.

I have used your new testing times, plus added these relative
measurements, which shoud give us the best of both worlds.  Patch
attached; you can see the results here:

	http://momjian.us/tmp/pgsql/pgcrypto.html

What speed was the I5 CPU you used?

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Attachments:

  [text/x-diff] crypto_timing.diff (4.0K, 2-crypto_timing.diff)
  download | inline diff:
diff --git a/doc/src/sgml/pgcrypto.sgml b/doc/src/sgml/pgcrypto.sgml
new file mode 100644
index 57d3401..0d04f7e
*** a/doc/src/sgml/pgcrypto.sgml
--- b/doc/src/sgml/pgcrypto.sgml
*************** gen_salt(type text [, iter_count integer
*** 312,367 ****
         <entry>Hashes/sec</entry>
         <entry>For <literal>[a-z]</></entry>
         <entry>For <literal>[A-Za-z0-9]</></entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry><literal>crypt-bf/8</></entry>
!        <entry>28</entry>
!        <entry>246 years</entry>
!        <entry>251322 years</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/7</></entry>
!        <entry>57</entry>
!        <entry>121 years</entry>
!        <entry>123457 years</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/6</></entry>
!        <entry>112</entry>
!        <entry>62 years</entry>
!        <entry>62831 years</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/5</></entry>
!        <entry>211</entry>
!        <entry>33 years</entry>
!        <entry>33351 years</entry>
        </row>
        <row>
         <entry><literal>crypt-md5</></entry>
!        <entry>2681</entry>
!        <entry>2.6 years</entry>
!        <entry>2625 years</entry>
        </row>
        <row>
         <entry><literal>crypt-des</></entry>
!        <entry>362837</entry>
!        <entry>7 days</entry>
!        <entry>19 years</entry>
        </row>
        <row>
         <entry><literal>sha1</></entry>
!        <entry>590223</entry>
!        <entry>4 days</entry>
!        <entry>12 years</entry>
        </row>
        <row>
         <entry><literal>md5 hash</></entry>
!        <entry>2345086</entry>
!        <entry>1 day</entry>
!        <entry>3 years</entry>
        </row>
       </tbody>
      </tgroup>
--- 312,376 ----
         <entry>Hashes/sec</entry>
         <entry>For <literal>[a-z]</></entry>
         <entry>For <literal>[A-Za-z0-9]</></entry>
+        <entry>Duration relative to <literal>md5 hash</></entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry><literal>crypt-bf/8</></entry>
!        <entry>1792</entry>
!        <entry>4 years</entry>
!        <entry>3927 years</entry>
!        <entry>100k</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/7</></entry>
!        <entry>3648</entry>
!        <entry>2 years</entry>
!        <entry>1929 years</entry>
!        <entry>50k</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/6</></entry>
!        <entry>7168</entry>
!        <entry>1 year</entry>
!        <entry>982 years</entry>
!        <entry>25k</entry>
        </row>
        <row>
         <entry><literal>crypt-bf/5</></entry>
!        <entry>13504</entry>
!        <entry>188 days</entry>
!        <entry>521 years</entry>
!        <entry>12.5k</entry>
        </row>
        <row>
         <entry><literal>crypt-md5</></entry>
!        <entry>171584</entry>
!        <entry>15 days</entry>
!        <entry>41 years</entry>
!        <entry>1k</entry>
        </row>
        <row>
         <entry><literal>crypt-des</></entry>
!        <entry>23221568</entry>
!        <entry>157.5 minutes</entry>
!        <entry>108 days</entry>
!        <entry>7</entry>
        </row>
        <row>
         <entry><literal>sha1</></entry>
!        <entry>37774272</entry>
!        <entry>90 minutes</entry>
!        <entry>68 days</entry>
!        <entry>4</entry>
        </row>
        <row>
         <entry><literal>md5 hash</></entry>
!        <entry>150085504</entry>
!        <entry>22.5 minutes</entry>
!        <entry>17 days</entry>
!        <entry>1</entry>
        </row>
       </tbody>
      </tgroup>
*************** gen_salt(type text [, iter_count integer
*** 374,380 ****
     <itemizedlist>
      <listitem>
       <para>
!      The machine used is a 1.5GHz Pentium 4.
       </para>
      </listitem>
      <listitem>
--- 383,389 ----
     <itemizedlist>
      <listitem>
       <para>
!      The machine used is an Intel Core i5.
       </para>
      </listitem>
      <listitem>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgcrypto docs
@ 2013-12-09 21:13  Bruce Momjian <[email protected]>
  parent: Bruce Momjian <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Bruce Momjian @ 2013-12-09 21:13 UTC (permalink / raw)
  To: Miles Elam <[email protected]>; +Cc: pgsql-docs

On Wed, Dec  4, 2013 at 12:42:08PM -0500, Bruce Momjian wrote:
> On Tue, May  7, 2013 at 03:47:43PM -0700, Miles Elam wrote:
> > Personally I've found the relative times instructive, merely outdated.  Perhaps
> > using md5 as a baseline and evaluating estimates relative to that baseline?
> > 
> > md5 = 1
> > sha1 = 4
> > crypt-des = 7
> > crypt-md5 = 1,000
> > crypt-bf/5 = 12,500
> > crypt-bf/6 = 25,000
> > crypt-bf/7 = 50,000
> > crypt-bf/8 = 100,000
> > 
> > This way, with the caveat that performance will vary from machine to machine,
> > there is a sense of the relative costs of using each algorithm, which does not
> > change as wildly with time.  It lets people know how bad md5 and sha1 are for
> > protecting passwords et al.  It also demonstrates that each turn of blowfish in
> > this module effectively doubles the time needed to crack and halves the number
> > of hashes one can perform.
> > 
> > In short, I'd hate for the baby to be thrown out with the bathwater.
> 
> I have used your new testing times, plus added these relative
> measurements, which shoud give us the best of both worlds.  Patch
> attached; you can see the results here:


Patch applied.  Thanks.  I updated the patch to say Intel i3..

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2013-12-09 21:13 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07 21:08 pgcrypto docs Miles Elam <[email protected]>
2013-05-07 22:05 ` Tom Lane <[email protected]>
2013-05-07 22:47   ` Miles Elam <[email protected]>
2013-12-04 17:42     ` Bruce Momjian <[email protected]>
2013-12-09 21:13       ` Bruce Momjian <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox