comparison src/com/tmate/hgkit/ll/DigestHelper.java @ 31:346b66add79d

Basic lookup for incoming changes
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 12 Jan 2011 00:30:55 +0100
parents 571e1b2cc3f7
children 858d1b2458cb
comparison
equal deleted inserted replaced
30:de7217a0aa4d 31:346b66add79d
1 /** 1 /*
2 * Copyright (c) 2010 Artem Tikhomirov 2 * Copyright (c) 2010, 2011 Artem Tikhomirov
3 */ 3 */
4 package com.tmate.hgkit.ll; 4 package com.tmate.hgkit.ll;
5 5
6 import java.io.IOException; 6 import java.io.IOException;
7 import java.io.InputStream; 7 import java.io.InputStream;
49 } 49 }
50 byte[] digest = alg.digest(); 50 byte[] digest = alg.digest();
51 return digest; 51 return digest;
52 } 52 }
53 53
54 public String toHexString(byte[] data, final int offset, final int count) { 54 public static String toHexString(byte[] data, final int offset, final int count) {
55 char[] result = new char[count << 1]; 55 char[] result = new char[count << 1];
56 final String hexDigits = "0123456789abcdef"; 56 final String hexDigits = "0123456789abcdef";
57 final int end = offset+count; 57 final int end = offset+count;
58 for (int i = offset, j = 0; i < end; i++) { 58 for (int i = offset, j = 0; i < end; i++) {
59 result[j++] = hexDigits.charAt((data[i] >>> 4) & 0x0F); 59 result[j++] = hexDigits.charAt((data[i] >>> 4) & 0x0F);