Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: Decent crypto library?

by vsespb (Chaplain)
on Oct 28, 2013 at 14:46 UTC ( #1059997=note: print w/replies, xml ) Need Help??

in reply to Re: Decent crypto library?
in thread Decent crypto library?

Thank you.

Crypt::Cipher::AES - there was a typo in my post. I already tried this one. And it's as slow as others in Crypt::CBC mode

Crypt::MCrypt - Cannot get it working with RIJNDAEL-256 (I tried also "aes", "aes256") - getting segfaults

Replies are listed 'Best First'.
Re^3: Decent crypto library?
by Anonymous Monk on Oct 28, 2013 at 17:10 UTC
      Thank you. 5.5 times slower. Not so bad.
      use strict; use warnings; use Digest::MD5 qw/md5_hex/; use Time::HiRes qw/tv_interval gettimeofday/; use Crypt::Mode::CBC; my $key = "\241(_E\203\223\337\322\317\214\24'\352\231\352\177W\\\6^\3 +21a\3\6:-qQ\r\225&\264"; my $IV = "<C\202\305\377\305\205\24\211\321\257\372z\363\333\357"; my $IV_hex = unpack('H*', $IV); my $key_hex = unpack('H*', $key); my $m = Crypt::Mode::CBC->new('AES'); my $s = "x" x 100_000_000; my $ciphertext = $m->encrypt($s, $key, $IV); my ($t0, $t1); $t0 = [gettimeofday]; my $ss = $m->decrypt($ciphertext, $key, $IV); $t1 = [gettimeofday]; die unless $ss eq $s; print "decrypt Crypt::Mode::CBC\t"; print tv_interval $t0, $t1; print "\n"; open my $f, ">", "/tmp/enctest"; binmode $f; print $f $ciphertext; close $f; my $sdata_md5 = md5_hex($s); $t0 = [gettimeofday]; unlink '/tmp/enctest.out'; system 'openssl', 'enc', '-aes-256-cbc', '-d', '-in', '/tmp/enctest', +'-out', '/tmp/enctest.out', '-K', $key_hex, '-iv', $IV_hex; $t1 = [gettimeofday]; print "decrypt OPENSSL\t"; print tv_interval $t0, $t1; print "\n"; die unless `md5sum /tmp/enctest.out` =~ /$sdata_md5/; __END__ decrypt Crypt::Mode::CBC 0.91427 decrypt OPENSSL 0.149651

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1059997]
NodeReaper wonders through a maze of twisty little sayings, all different

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2018-05-26 20:26 GMT
Find Nodes?
    Voting Booth?