/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Generate a random sequence of bytes and return its hex representation * * @param nbBytes number of bytes to generate * @return hex string */ private String randomBytes(final int nbBytes) { final byte[] bytes = new byte[nbBytes]; randomGenerator.nextBytes(bytes); return bytesToHex(bytes); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }
/** * Colon separated value MD5 hash. * * @param tokens one or more strings * @return M5 hash string * @throws IOException */ private static String md5(final String... tokens) throws IOException { final StringBuilder sb = new StringBuilder(100); for (final String token : tokens) { if (sb.length() > 0) { sb.append(':'); } sb.append(token); } final MessageDigest md; try { md = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException ex) { throw new IOException(ex.getMessage()); } md.update(sb.toString().getBytes(HttpAuthenticationFilter.CHARACTER_SET), 0, sb.length()); final byte[] md5hash = md.digest(); return bytesToHex(md5hash); }