public static String calculateSHA1 ( String string ) { MessageDigest md = null ; try { md = MessageDigest . getInstance ( "SHA-1" ) ; } catch ( NoSuchAlgorithmException e ) { QuickUtils . log . e ( "NoSuchAlgorithmException" , e ) ; } try { md . update ( string . getBytes ( "iso-8859-1" ) , 0 , string . length ( ) ) ; } catch ( UnsupportedEncodingException e ) { QuickUtils . log . e ( "UnsupportedEncodingException" , e ) ; } byte [ ] sha1hash = md . digest ( ) ; return convertToHex ( sha1hash ) ; }
Calculate the SHA - 1 of a given String