public static String hash ( final String str ) { try { final MessageDigest md = new Sha1 ( ) ; final byte [ ] hashed = md . digest ( str . getBytes ( "UTF-8" ) ) ; final byte [ ] encoded = Base64 . encodeBase64 ( hashed ) ; return new String ( encoded , "UTF-8" ) ; } catch ( final UnsupportedEncodingException e ) { LOG . error ( "Encoding error??" , e ) ; return "" ; } }
Creates a base 64 encoded SHA - 1 hash of the specified string .