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"));
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java