public static byte [ ] sha1 ( byte [ ] data ) { try { //Attempt to get a MessageDigest that uses SHA1 MessageDigest md = MessageDigest . getInstance ( "SHA1" ) ; //Hash the data return md . digest ( data ) ; } catch ( NoSuchAlgorithmException e ) { //Alright, you might have an old system. throw new InternalError ( "SHA-1 is not supported on this platform - Outdated?" ) ; } }
Performs a SHA - 1 hash on the specified data