public synchronized String encrypt ( String plaintext ) { MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA" ) ; md . update ( plaintext . getBytes ( UTF8 ) ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , "Should not happen!" , e ) ; } byte raw [ ] = md . digest ( ) ; return encode ( raw ) ; }
Encrypt a string using SHA