public Key < byte [ ] > start ( final String algorithm ) throws NoSuchAlgorithmException { final MessageDigest digest = MessageDigest . getInstance ( algorithm ) ; final Key < byte [ ] > object = new Key < byte [ ] > ( ) ; consumers . put ( object , new Consumer < byte [ ] > ( ) { public void consume ( final ByteBuffer buffer ) { try { digest . update ( buffer ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } public byte [ ] finish ( ) { try { return digest . digest ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } } ) ; return object ; }
Initialize a digest on this channel .