Code example for MessageDigest

Methods: digestgetAlgorithm

0
 
    private MessageDigest messageDigest;
    private BASE64Encoder encoder;
 
    protected void useAlgorithm(String algorithm) throws NoSuchAlgorithmException {
        if (messageDigest == null || messageDigest.getAlgorithm() != algorithm) {
            messageDigest = MessageDigest.getInstance(algorithm);
        } 
 
        if (encoder == null) {
            encoder = new BASE64Encoder();
        } 
    } 
 
    protected String encryptByAlgorithm(String algorithm, String value)
            throws NoSuchAlgorithmException { 
 
        if (value == null) {
            throw new IllegalArgumentException("The value is null.");
        } 
Contextual code suggestions in your IDE  Get Codota for Java