diff options
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r-- | src/eu/siacs/conversations/utils/CryptoHelper.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/CryptoHelper.java b/src/eu/siacs/conversations/utils/CryptoHelper.java new file mode 100644 index 00000000..6e606fa1 --- /dev/null +++ b/src/eu/siacs/conversations/utils/CryptoHelper.java @@ -0,0 +1,14 @@ +package eu.siacs.conversations.utils; + +public class CryptoHelper { + final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); + public static String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for ( int j = 0; j < bytes.length; j++ ) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0x0F]; + } + return new String(hexChars); + } +} |