Skip to content

Commit

Permalink
Hook up new native crypt code (disabled uses pure Java version of DES)
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Dec 3, 2014
1 parent 276b5f6 commit f309f0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/RubyString.java
Expand Up @@ -2653,13 +2653,13 @@ public IRubyObject prepend(ThreadContext context, IRubyObject other) {
@JRubyMethod(name = "crypt")
public RubyString crypt(ThreadContext context, IRubyObject other) {
RubyString otherStr = other.convertToString();
ByteList salt = otherStr.getByteList();
if (salt.getRealSize() < 2) {
String salt = otherStr.asJavaString();
if (salt.length() < 2) {
throw context.runtime.newArgumentError("salt too short(need >=2 bytes)");
}

salt = salt.makeShared(0, 2);
RubyString result = RubyString.newStringShared(context.runtime, JavaCrypt.crypt(salt, this.getByteList()));
RubyString result = RubyString.newString(context.runtime,
context.runtime.getPosix().crypt(salt, asJavaString()).toString());
result.infectBy(this);
result.infectBy(otherStr);
return result;
Expand Down

0 comments on commit f309f0f

Please sign in to comment.