protected static String print16(PublicKey pub_key) { // use SHA256 to create a hash of secret_key and only then truncate it to secret_key_length MessageDigest digest=null; try { digest=MessageDigest.getInstance("SHA-256"); digest.update(pub_key.getEncoded()); return Util.byteArrayToHexString(digest.digest(), 0, 16); } catch(NoSuchAlgorithmException e) { return e.toString(); } }
protected static String print16(PublicKey pub_key) { // use SHA256 to create a hash of secret_key and only then truncate it to secret_key_length MessageDigest digest=null; try { digest=MessageDigest.getInstance("SHA-256"); digest.update(pub_key.getEncoded()); return Util.byteArrayToHexString(digest.digest(), 0, 16); } catch(NoSuchAlgorithmException e) { return e.toString(); } }
/** * Used for SHA1 hack * @since 0.8.5 */ private void createDigest() { if (sha_digest == null) { try { sha_digest = MessageDigest.getInstance("SHA"); } catch(NoSuchAlgorithmException nsa) { throw new InternalError(nsa.toString()); } } else { // there are two info maps, but not one inside the other, // the resulting hash will be incorrect // throw something? - no, the check in the MetaInfo constructor will catch it. } }
/** * Factory method for constructing UUID generator that uses specified * random number generator for constructing UUIDs according to standard * method number 3 or 5, with specified namespace (or without one if null * is specified), using specified digester. * If digester is passed as null, a SHA-1 digester will be constructed. * * @param namespace UUID that represents namespace to use; see * {@link NameBasedGenerator} for 'standard' namespaces specified by * UUID specs * @param digester Digester to use; should be a MD5 or SHA-1 digester. */ public static NameBasedGenerator nameBasedGenerator(UUID namespace, MessageDigest digester) { UUIDType type = null; if (digester == null) { try { digester = MessageDigest.getInstance("SHA-1"); type = UUIDType.NAME_BASED_SHA1; } catch (NoSuchAlgorithmException nex) { throw new IllegalArgumentException("Couldn't instantiate SHA-1 MessageDigest instance: "+nex.toString()); } } return new NameBasedGenerator(namespace, digester, type); }
Log.e(LOG_TAG, ex.toString());
Log.e(LOG_TAG, ex.toString());
} catch (NoSuchAlgorithmException ex) { logger.log(Level.FINE, "NoSuchAlgorithmException", ex); throw new IOException(ex.toString());
} catch (NoSuchAlgorithmException ex) { logger.log(Level.FINE, "NoSuchAlgorithmException", ex); throw new IOException(ex.toString());
private static byte[] getKeyBytes(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return digest.digest(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "Password creation exception: " + e.toString()); return errorbyte; } }
private static byte[] getKeyBytes(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return digest.digest(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "Password creation exception: " + e.toString()); return errorbyte; } }
private static byte[] getKeyBytes(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return digest.digest(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "Password creation exception: " + e.toString()); return errorbyte; } }
public static String getMD5(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return bytesToHex(digest.digest()).toLowerCase(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "MD5 hash exception: " + e.toString()); return null; } }
public static String getMD5String(String value) { try { MessageDigest md = MessageDigest.getInstance("md5"); byte[] e = md.digest(value.getBytes()); return toHexString(e); } catch (NoSuchAlgorithmException e) { logger.error("MD5Utils || getMD5String" +e.toString()); return value; } }
public static String getSHA256(byte[] mydata) { try { MessageDigest digest = java.security.MessageDigest .getInstance("SHA256"); digest.update(mydata); return bytesToHex(digest.digest()).toLowerCase(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "SHA hash exception: " + e.toString()); return null; } }
public static String getSHA256(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("SHA256"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return bytesToHex(digest.digest()).toLowerCase(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "SHA hash exception: " + e.toString()); return null; } }
private static MessageDigest getInstance() { if (INSTANCE == null) { try { INSTANCE = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException anE) { BasicLogger.error(anE.toString()); } } return INSTANCE; }
private static MessageDigest getInstance() { if (INSTANCE == null) { try { INSTANCE = MessageDigest.getInstance("MD5"); } catch (final NoSuchAlgorithmException anE) { BasicLogger.error(anE.toString()); } } return INSTANCE; }
protected static String print16(PublicKey pub_key) { // use SHA256 to create a hash of secret_key and only then truncate it to secret_key_length MessageDigest digest=null; try { digest=MessageDigest.getInstance("SHA-256"); digest.update(pub_key.getEncoded()); return Util.byteArrayToHexString(digest.digest(), 0, 16); } catch(NoSuchAlgorithmException e) { return e.toString(); } }
public static String getSHA256(byte[] mydata) { try { MessageDigest digest = java.security.MessageDigest .getInstance("SHA256"); digest.update(mydata); return bytesToHex(digest.digest()).toLowerCase(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "SHA hash exception: " + e.toString()); return null; } }
public static String getMD5(String mykey) { try { MessageDigest digest = java.security.MessageDigest .getInstance("MD5"); digest.update(mykey.getBytes(Charset.forName("UTF-8"))); return bytesToHex(digest.digest()).toLowerCase(); } catch (NoSuchAlgorithmException e) { Log.e(TAG, "MD5 hash exception: " + e.toString()); return null; } }