import javax.xml.bind.annotation.adapters.HexBinaryAdapter; public byte[] hexToBytes(String hexString) { HexBinaryAdapter adapter = new HexBinaryAdapter(); byte[] bytes = adapter.unmarshal(hexString); return bytes; }
public static String getHash(String str) { if(str != null) try { MessageDigest md = MessageDigest.getInstance("SHA-256"); return new HexBinaryAdapter().marshal(md.digest(dontRainbowTableMeOrMySonEverAgain(str).getBytes())); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return ""; }
private HexBinaryAdapter hexAdapter = new HexBinaryAdapter(); oos.close(); byte[] serializedBytes = baos.toByteArray(); return hexAdapter.marshal(serializedBytes); byte[] serializedBytes = hexAdapter.unmarshal(v); ByteArrayInputStream bais = new ByteArrayInputStream(serializedBytes); ObjectInputStream ois = new ObjectInputStream(bais);
String hex = (new HexBinaryAdapter()).marshal(md5.digest(YOUR_STRING.getBytes()))
public static String bytesToString(byte[] bytes) { HexBinaryAdapter adapter = new HexBinaryAdapter(); String s = adapter.marshal(bytes); return s; }
String hex = (new HexBinaryAdapter()).marshal(md5.digest(YOUR_STRING.getBytes()))
HexBinaryAdapter hba = new HexBinaryAdapter(); String md5 = hba.marshal(s); return md5;
throw new IOException("<xattr> had no <val> or <valHex> entry."); val = new HexBinaryAdapter().unmarshal(valHex); } else { val = valStr.getBytes("UTF8");
System.out.println((new HexBinaryAdapter()).marshal(hash));
/** * Determines the sha1 hash (hex representation) of the data provided by the input stream. */ static String readSha1(InputStream inputStream) throws NoSuchAlgorithmException, IOException { MessageDigest sha1Digest = MessageDigest.getInstance("SHA-1"); byte[] buf = new byte[ANY_SIZE]; int n; while ((n = inputStream.read(buf)) > 0) { sha1Digest.update(buf, 0, n); } return new HexBinaryAdapter().marshal(sha1Digest.digest()); }
public synchronized static byte[] hexToBytes(String hexString) { HexBinaryAdapter adapter = new HexBinaryAdapter(); byte[] bytes = adapter.unmarshal(hexString); return bytes; }
return new HexBinaryAdapter().marshal(sha1.digest());
protected String getMd5Sum(HttpServletRequest request) throws NoSuchAlgorithmException, UnsupportedEncodingException { return new HexBinaryAdapter().marshal(getMd5Digest(request).digest()); }
public byte[] hexToBytes(String hexString) { HexBinaryAdapter adapter = new HexBinaryAdapter(); byte[] bytes = adapter.unmarshal(hexString); return bytes; } }
/** * Gets the unique ID. * * @param idstring * the idstring * @return the unique ID */ public static String getUniqueID(String idstring) { try { MessageDigest md5 = MessageDigest.getInstance("MD5"); return (new HexBinaryAdapter()).marshal(md5.digest(idstring.getBytes())); } catch (NoSuchAlgorithmException e) { LOGGER.error("Error in getUniqueID",e); } return ""; }
public static byte[] hexToBytes(String hexString) { HexBinaryAdapter adapter = new HexBinaryAdapter(); byte[] bytes = adapter.unmarshal(hexString); return bytes; }
public static String hash(String str) { String sHash = ""; try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(str.getBytes()); sHash = (new HexBinaryAdapter()).marshal(md.digest(str.getBytes())); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return sHash; } }
/** * Gets the value of the xorPattern property. * * @return * possible object is * {@link String } * */ public byte[] getXorPattern() { if (xorPattern == null) { return new HexBinaryAdapter().unmarshal("55AA55AA55AA55BB"); } else { return xorPattern; } }
protected File getDoneFile(URI basedir, URI wsdlURI, String mojo) { String doneFileName = mojo + wsdlURI.toString(); try { MessageDigest cript = MessageDigest.getInstance("SHA-1"); cript.reset(); cript.update(doneFileName.getBytes("utf8")); doneFileName = new javax.xml.bind.annotation.adapters.HexBinaryAdapter().marshal(cript.digest()); } catch (Exception e) { //ignore, we'll try and fake it based on the wsdl // Strip the basedir from the doneFileName if (doneFileName.startsWith(basedir.toString())) { doneFileName = doneFileName.substring(basedir.toString().length()); } // If URL to WSDL, replace ? and & since they're invalid chars for file names // Not to mention slashes. doneFileName = doneFileName.replace('?', '_').replace('&', '_').replace('/', '_').replace('\\', '_') .replace(':', '_'); doneFileName += ".DONE"; } return new File(markerDirectory, "." + doneFileName); }
"lacked a <key> field."); byte[] key = new HexBinaryAdapter().unmarshal(keyHex); dkey.verifyNoRemainingKeys(SECRET_MANAGER_SECTION_DELEGATION_KEY); dbld.setKey(ByteString.copyFrom(key));