samples/messagedigest/src-bridge/org/apidesign/impl/security/extension/BridgeToOldAlgorithmsProvider.java
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
6 package org.apidesign.impl.security.extension;
8 import org.apidesign.impl.security.friendapi.DigestImplementation;
9 import org.apidesign.impl.security.friendapi.DigestProvider;
10 import java.nio.ByteBuffer;
11 import java.security.MessageDigest;
12 import java.security.NoSuchAlgorithmException;
13 import java.util.logging.Level;
14 import java.util.logging.Logger;
18 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
20 public class BridgeToOldAlgorithmsProvider implements DigestProvider {
22 public DigestImplementation create(String algorithm) {
24 final MessageDigest md = MessageDigest.getInstance(algorithm);
25 return new DigestImplementation(algorithm) {
28 public void update(ByteBuffer bb) {
33 public byte[] digest() {
37 } catch (NoSuchAlgorithmException ex) {
38 Logger.getLogger(BridgeToOldAlgorithmsProvider.class.getName()).log(Level.INFO, null, ex);