public static String hashSHA ( String str ) { byte [ ] b = str . getBytes ( ) ; MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA1" ) ; md . update ( b ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; // it's got to be there } return toHexString ( md . digest ( ) ) ; }
Returns the SHA hash of a String .