2015-07-01 137 views
0

工作我试图做一个捆绑安装的JRuby(Windows)和我收到此错误:JRuby的捆绑安装不宝石“scrypt”

C:/jruby-1.7.19/bin/jruby.exe -rubygems C:/jruby-1.7.19/lib/ruby/gems/shared/gems/rake-10.1.0/bin/rake RUBYARCHDIR=C:/jruby-1.7.19/lib/ruby/gems/shared/extensions/universal-java-1.8/1.9/scrypt-2.0.2 RUBYLIBDIR=C:/jruby-1.7.19/lib/ruby/gems/shared/extensions/universal-java-1.8/1.9/scrypt-2.0.2 
io/console not supported; tty will not be manipulated 
mkdir -p i386-windows 
cc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -fPIC -o i386-windows/crypto_scrypt-sse.o -c ./crypto_scrypt-sse.c 
rake aborted! 
Command failed with status (127): [cc -fexceptions -O -fno-omit-frame-pointer...] 
org/jruby/RubyProc.java:271:in `call' 
org/jruby/RubyProc.java:271:in `call' 
org/jruby/RubyArray.java:1613:in `each' 
org/jruby/RubyArray.java:1613:in `each' 
org/jruby/RubyArray.java:1613:in `each' 
org/jruby/RubyArray.java:1613:in `each' 
Tasks: TOP => default => i386-windows/scrypt_ext.dll => i386-windows/crypto_scrypt-sse.o 
(See full trace by running task with --trace) 

rake failed, uncaught signal 1 

我已经安装了JRuby和JVM。

回答

0

你试图安装红宝石的Java版本内原生扩展宝石:通常是一个糟糕的主意......

我发现在https://github.com/wg/scrypt scrypt算法的纯Java实现。

您需要从Maven(http://search.maven.org/remotecontent?filepath=com/lambdaworks/scrypt/1.4.0/scrypt-1.4.0.jar)下载jar文件,将其添加到您的库路径或需要代码中的jar。

接下来是编写一个包装来模仿scrypt行为,将它用作ruby/rails代码中的插入替换。

或者,您可以直接删除scrypt位并使用java库。下面是jirb(1.7.20)测试的一个片段:

>> require 'java' 
=> true 
>> require './scrypt-1.4.0.jar' 
=> true 
>> java_import 'com.lambdaworks.crypto.SCryptUtil' 
=> [Java::ComLambdaworksCrypto::SCryptUtil] 
>> passwd,n,r,p = 'secret',16384,8,1 
=> ["secret", 16384, 8, 1] 
>> hashed_passwd = SCryptUtil.scrypt(passwd,n,r,p) 
=> "$s0$e0801$MzcxaOBVz7kaVU6E5HV0cg==$RAx9ADWVeyZE5JRl+J1NpiBSEPNabEcVdR7drddpgMw=" 
>> SCryptUtil.check(passwd,hashed_passwd) 
=> true 
>> SCryptUtil.check('wrong password',hashed_passwd) 
=> false 
0

这是晚了,但我只是wrote一个多平台gem它包装起来的细节作为API下拉更换为scrypt gem

gem install scrypt-ruby -P MediumSecurity

相关问题