public static byte [ ] getSHA256 ( byte [ ] input , boolean asSingleton ) { if ( SHA256_INSTANCE == null ) { if ( asSingleton ) { try { SHA256_INSTANCE = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; } } else { return getHash ( "SHA-256" , input ) ; } } return SHA256_INSTANCE . digest ( input ) ; }
Get the SHA256 Hash of input