src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java

Print this page
rev 10521 : 8055723[core]: Replace concat String to append in StringBuilder parameters
Contributed-by: Otavio Santana <otaviojava@java.net>


 623             for (i = outbits-1; i >= 0; i--) {
 624                 /* do the addition */
 625                 thisbyte += (out[i]&0xff);
 626                 out[i] = (byte) (thisbyte&0xff);
 627 
 628                 /* keep around the carry bit, if any */
 629                 thisbyte >>>= 8;
 630             }
 631         }
 632 
 633         return out;
 634     }
 635 
 636     // Routines used for debugging
 637     static String bytesToString(byte[] digest) {
 638         // Get character representation of digest
 639         StringBuilder digestString = new StringBuilder();
 640 
 641         for (int i = 0; i < digest.length; i++) {
 642             if ((digest[i] & 0x000000ff) < 0x10) {
 643                 digestString.append("0" +
 644                     Integer.toHexString(digest[i] & 0x000000ff));
 645             } else {
 646                 digestString.append(
 647                     Integer.toHexString(digest[i] & 0x000000ff));
 648             }
 649         }
 650         return digestString.toString();
 651     }
 652 
 653     private static byte[] binaryStringToBytes(String str) {
 654         char[] usageStr = str.toCharArray();
 655         byte[] usage = new byte[usageStr.length/2];
 656         for (int i = 0; i < usage.length; i++) {
 657             byte a = Byte.parseByte(new String(usageStr, i*2, 1), 16);
 658             byte b = Byte.parseByte(new String(usageStr, i*2 + 1, 1), 16);
 659             usage[i] = (byte) ((a<<4)|b);
 660         }
 661         return usage;
 662     }
 663 
 664     static void traceOutput(String traceTag, byte[] output, int offset,




 623             for (i = outbits-1; i >= 0; i--) {
 624                 /* do the addition */
 625                 thisbyte += (out[i]&0xff);
 626                 out[i] = (byte) (thisbyte&0xff);
 627 
 628                 /* keep around the carry bit, if any */
 629                 thisbyte >>>= 8;
 630             }
 631         }
 632 
 633         return out;
 634     }
 635 
 636     // Routines used for debugging
 637     static String bytesToString(byte[] digest) {
 638         // Get character representation of digest
 639         StringBuilder digestString = new StringBuilder();
 640 
 641         for (int i = 0; i < digest.length; i++) {
 642             if ((digest[i] & 0x000000ff) < 0x10) {
 643                 digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));

 644             } else {
 645                 digestString.append(
 646                     Integer.toHexString(digest[i] & 0x000000ff));
 647             }
 648         }
 649         return digestString.toString();
 650     }
 651 
 652     private static byte[] binaryStringToBytes(String str) {
 653         char[] usageStr = str.toCharArray();
 654         byte[] usage = new byte[usageStr.length/2];
 655         for (int i = 0; i < usage.length; i++) {
 656             byte a = Byte.parseByte(new String(usageStr, i*2, 1), 16);
 657             byte b = Byte.parseByte(new String(usageStr, i*2 + 1, 1), 16);
 658             usage[i] = (byte) ((a<<4)|b);
 659         }
 660         return usage;
 661     }
 662 
 663     static void traceOutput(String traceTag, byte[] output, int offset,