Skip to content
Closed
Prev Previous commit
Next Next commit
Removed unnecessary for loop that once filled the salt.
Note that the "// NOOP" comment was misleading, the salt variable
actually was modified inside the for loop.

This functionality will never be used though as the salt is checked
some lines above to an exact length of 2. Filling it with "A" would
be a very bad idea anyway as e.g. glibc fills a one-char salt with
exactly the same char so our implementation would have been incompatible!
  • Loading branch information
Christian Hammers committed Sep 1, 2012
commit 878618cecb7b2f03550f0bb0e6642ca96187cbae
4 changes: 0 additions & 4 deletions src/main/java/org/apache/commons/codec/digest/UnixCrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ public static String crypt(byte[] original, String salt) {
throw new IllegalArgumentException("Invalid salt value: " + salt);
}

for (; salt.length() < 2; salt = salt + "A") {
// NOOP
}

StringBuilder buffer = new StringBuilder(" ");
char charZero = salt.charAt(0);
char charOne = salt.charAt(1);
Expand Down