Skip to content

Commit f309f0f

Browse files
committed
Hook up new native crypt code (disabled uses pure Java version of DES)
1 parent 276b5f6 commit f309f0f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/main/java/org/jruby/RubyString.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2653,13 +2653,13 @@ public IRubyObject prepend(ThreadContext context, IRubyObject other) {
26532653
@JRubyMethod(name = "crypt")
26542654
public RubyString crypt(ThreadContext context, IRubyObject other) {
26552655
RubyString otherStr = other.convertToString();
2656-
ByteList salt = otherStr.getByteList();
2657-
if (salt.getRealSize() < 2) {
2656+
String salt = otherStr.asJavaString();
2657+
if (salt.length() < 2) {
26582658
throw context.runtime.newArgumentError("salt too short(need >=2 bytes)");
26592659
}
26602660

2661-
salt = salt.makeShared(0, 2);
2662-
RubyString result = RubyString.newStringShared(context.runtime, JavaCrypt.crypt(salt, this.getByteList()));
2661+
RubyString result = RubyString.newString(context.runtime,
2662+
context.runtime.getPosix().crypt(salt, asJavaString()).toString());
26632663
result.infectBy(this);
26642664
result.infectBy(otherStr);
26652665
return result;

0 commit comments

Comments
 (0)