Commit cbf96b56c7d0b393c51ab0fd156365cf162b642f
Merge pull request #49 from jabley/string-builder
Prefer StringBuilder to StringBufferAman Gupta committed on 3/31/2013, 3:23:26 AM
Parent: d2dceb85119745ede21773347704559e35f67266
Parent: c7647f059adbb72fb8e4423655861f7e4df432bf
Files changed
ext/jruby/bcrypt_jruby/BCrypt.java | changed |
ext/jruby/bcrypt_jruby/BCrypt.java | ||
---|---|---|
@@ -385,9 +385,9 @@ | ||
385 | 385 | */ |
386 | 386 | private static String encode_base64(byte d[], int len) |
387 | 387 | throws IllegalArgumentException { |
388 | 388 | int off = 0; |
389 | - StringBuffer rs = new StringBuffer(); | |
389 | + StringBuilder rs = new StringBuilder(); | |
390 | 390 | int c1, c2; |
391 | 391 | |
392 | 392 | if (len <= 0 || len > d.length) |
393 | 393 | throw new IllegalArgumentException ("Invalid len"); |
@@ -438,9 +438,9 @@ | ||
438 | 438 | * if maxolen is invalid | IllegalArgumentException
439 | 439 | */ |
440 | 440 | private static byte[] decode_base64(String s, int maxolen) |
441 | 441 | throws IllegalArgumentException { |
442 | - StringBuffer rs = new StringBuffer(); | |
442 | + StringBuilder rs = new StringBuilder(); | |
443 | 443 | int off = 0, slen = s.length(), olen = 0; |
444 | 444 | byte ret[]; |
445 | 445 | byte c1, c2, c3, c4, o; |
446 | 446 | |
@@ -650,9 +650,9 @@ | ||
650 | 650 | String real_salt; |
651 | 651 | byte passwordb[], saltb[], hashed[]; |
652 | 652 | char minor = (char)0; |
653 | 653 | int rounds, off = 0; |
654 | - StringBuffer rs = new StringBuffer(); | |
654 | + StringBuilder rs = new StringBuilder(); | |
655 | 655 | |
656 | 656 | if (salt.charAt(0) != '$' || salt.charAt(1) != '2') |
657 | 657 | throw new IllegalArgumentException ("Invalid salt version"); |
658 | 658 | if (salt.charAt(2) == '$') |
@@ -703,9 +703,9 @@ | ||
703 | 703 | * | random an instance of SecureRandom to use
704 | 704 | * | an encoded salt value
705 | 705 | */ |
706 | 706 | public static String gensalt(int log_rounds, SecureRandom random) { |
707 | - StringBuffer rs = new StringBuffer(); | |
707 | + StringBuilder rs = new StringBuilder(); | |
708 | 708 | byte rnd[] = new byte[BCRYPT_SALT_LEN]; |
709 | 709 | |
710 | 710 | random.nextBytes(rnd); |
711 | 711 |
Built with git-ssb-web