CryptoHelper.java

 1package eu.siacs.conversations.utils;
 2
 3public class CryptoHelper {
 4	final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
 5	public static String bytesToHex(byte[] bytes) {
 6	    char[] hexChars = new char[bytes.length * 2];
 7	    for ( int j = 0; j < bytes.length; j++ ) {
 8	        int v = bytes[j] & 0xFF;
 9	        hexChars[j * 2] = hexArray[v >>> 4];
10	        hexChars[j * 2 + 1] = hexArray[v & 0x0F];
11	    }
12	    return new String(hexChars);
13	}
14}