Code example for NoSuchAlgorithmException

Methods: getMessage

0
 
        final MessageDigest md;
        try { 
            md = MessageDigest.getInstance("SHA");
        } catch (NoSuchAlgorithmException e) {
            throw new IllegalStateException(e.getMessage(), e);
        } 
 
        try { 
            md.update(plaintextPassword.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException(e.getMessage(), e);
        } 
 
        return new String(Base64.encodeBase64(md.digest()), Charset.forName("UTF-8"));
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE