Giter Club home page Giter Club logo

attr_encrypted_pgcrypto's People

Contributors

dependabot[bot] avatar gabetax avatar jcbantuelle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

attr_encrypted_pgcrypto's Issues

Benchmark is no accurate

Hi there,

I was curious about your benchmark figures and after some research worked out that they are not accurate.

Section 5.8 in http://web.mit.edu/jhawk/mnt/spo/postgres-8.2/src/postgresql-8.2.5/contrib/pgcrypto/README.pgcrypto states that the default algorithm used is aes-128. attr_entrypted uses aes-256 as a default.

I modified your code to specify the aes-256 algorithm and the benchmark figures changed.

def encrypt(*args, &block)
  escape_and_execute_sql(["SELECT pgp_sym_encrypt(?, ?, 'cipher-algo=aes256')", value(args), key(args)])['pgp_sym_encrypt']
end

Note I also changed the benchmark to test decryption:

Before:

                         user     system      total        real
pgcrypto             0.720000   0.280000   1.000000 (  4.378661)
pgcrypto - decrypt   0.740000   0.270000   1.010000 (  4.422669)
openssl              8.340000   0.010000   8.350000 (  8.351276)
openssl - decrypt    8.530000   0.020000   8.550000 (  8.564866)

after

                         user     system      total        real
pgcrypto             0.740000   0.260000   1.000000 (  7.003118)
pgcrypto - decrypt   0.810000   0.280000   1.090000 (  7.171194)
openssl              8.790000   0.020000   8.810000 (  8.821168)
openssl - decrypt    8.530000   0.010000   8.540000 (  8.543087)

Using pgcrypto was still faster but not as much as when only using 128 bit encryption.

Cheers
Peter

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.