Giter Club home page Giter Club logo

blake2's People

Contributors

franckverrot avatar grempe avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

blake2's Issues

Running many blake2 hashes in a loop results in Ruby segfault due to GC

Hi, I am working on a pretty significant pull request to this gem that I would like to submit very soon. However I have run into a showstopper issue with the gem as it is right now. There is apparently some kind of a memory allocation or cleanup issue in the C extension code that causes a segfault if Ruby Garbage collection is turned on (as it generally always is). Here is some sample code I have created that demonstrates the issue every time on my machine (OS X El Capitan). I also tried this under several versions of Ruby with the same outcome. The segfault messages are always different since I think the segfault happens at random times based on when Ruby decides to do a GC sweep so they are pretty much useless as far as I can tell. I suspect something is getting GC'ed while it is still in use.

#!/usr/bin/env ruby
require 'blake2'

# If GC is disabled this will run cleanly through
# thousands of iterations. If GC is running normally
# if will crash after a couple of thousand hashes pretty
# much every time. Uncomment this to allow clean runs.
#GC.disable

i = 0
100000.times do
  puts i if i % 1000 == 0
  Blake2.new(32, Blake2::Key.none).digest('abc', :to_hex)
  i += 1
end

Unless I uncomment the GC.disable line this fails after a few thousand hashes every time for me.

Unfortunately, I don't have much experience with C or Ruby C extensions. Do you think you could take a look?

Cheers,

Glenn

Convert license to MIT

As discussed in #6, I would like to change the license from GPL to MIT.

Hopefully there’s only one contributor, @grempe : please respond to this issue with “OK”, or “not OK”. Should you not be OK with the change please respond to the private email I sent you today but feel free to respond here too.

If you’re OK, I’ll change the license ASAP.

Thanks in advance!

[SOLVED] Install on Ruby 1.9.3-p448 fails with `string.h: No such file or directory`

Are there any dependencies I'm missing?

When I try to install blake2 gem I get...

Building native extensions.  This could take a while...
ERROR:  Error installing blake2:
    ERROR: Failed to build gem native extension.

        /home/phil/.rbenv/versions/1.9.3-p448/bin/ruby extconf.rb
creating Makefile

make
compiling rbext.c
In file included from rbext.c:1:0:
/home/phil/.rbenv/versions/1.9.3-p448/include/ruby-1.9.1/ruby/ruby.h:48:21: fatal error: string.h: No such file or directory
compilation terminated.
make: *** [rbext.o] Error 1


Gem files will remain installed in /home/phil/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/blake2-0.1.0 for inspection.
Results logged to /home/phil/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/blake2-0.1.0/ext/blake2_ext/gem_make.out

It should reject key larger than 32 bytes

Hi,
I accidentally mess my data up after I set the blake2 key using input larger than 32 bytes, which result in broken hashes.
It would be nice if the library raises an error when encountering an unexpectedly large key than the function supports.

Install on Ruby 2.1.2 fails with `stdio.h: No such file or directory`

Building native extensions.  This could take a while...
ERROR:  Error installing blake2:
    ERROR: Failed to build gem native extension.

    /home/phil/.rbenv/versions/2.1.2/bin/ruby extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling rbext.c
In file included from /home/phil/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/ruby.h:29:0,
                 from rbext.c:1:
/home/phil/.rbenv/versions/2.1.2/include/ruby-2.1.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
make: *** [rbext.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/phil/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/blake2-0.1.0 for inspection.
Results logged to /home/phil/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/blake2-0.1.0/gem_make.out

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.