Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too slow? #1

Open
powerman opened this issue Jul 20, 2015 · 0 comments
Open

too slow? #1

powerman opened this issue Jul 20, 2015 · 0 comments

Comments

@powerman
Copy link

I wonder why Go's bcrypt is 1.5 times slower than Perl's one? Look (I don't use shell's time for perl to exclude perl's startup time, which is much larger than Go's):

$ time bcrypt-tool hash '0123456789' 10
$2a$10$God/j.dxKvryLSZfCAziMuMeZBfV28Xu24G6liCxlQbCM3PNs17S.

real    0m0.073s
user    0m0.072s
sys 0m0.000s

$ perl -E '
    use Crypt::Eksblowfish::Bcrypt qw(en_base64 bcrypt);
    use Time::HiRes qw(time);
    $t=time;
    open my $rand, "<", "/dev/urandom" or die $!;
    16 == sysread $rand, my $salt, 16 or die $!;
    close $rand or die $!;
    say bcrypt("0123456789", q{$2a$10$}.en_base64($salt));
    say time-$t;
'
$2a$10$WgABAl2bimF7wAOpRebTL.FQdV4n8Ho0/cWA4pGas.PUKpQTbYAL6
0.0554509162902832

Well, to be 100% honest this Perl module is partially implemented in C, but, still, Go shouldn't be 1.5 times slower than C on such tasks, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant