Skip to content
Permalink
Browse files
Hook up new native crypt code (disabled uses pure Java version of DES)
  • Loading branch information
enebo committed Dec 3, 2014
1 parent 276b5f6 commit f309f0f1a1d55101ec7bbbbd27f0d948734bbffe
Showing with 4 additions and 4 deletions.
  1. +4 −4 core/src/main/java/org/jruby/RubyString.java
@@ -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;

0 comments on commit f309f0f

Please sign in to comment.