synchronized static private byte [ ] getSecret ( ) throws Exception { if ( null == secret ) { Date now = new Date ( ) ; long nowValue = now . getTime ( ) ; byte [ ] nowBytes = new byte [ 8 ] ; nowBytes [ 0 ] = ( byte ) ( ( nowValue >> 0 ) & 0xff ) ; nowBytes [ 1 ] = ( byte ) ( ( nowValue >> 8 ) & 0xff ) ; nowBytes [ 2 ] = ( byte ) ( ( nowValue >> 16 ) & 0xff ) ; nowBytes [ 3 ] = ( byte ) ( ( nowValue >> 24 ) & 0xff ) ; nowBytes [ 4 ] = ( byte ) ( ( nowValue >> 32 ) & 0xff ) ; nowBytes [ 5 ] = ( byte ) ( ( nowValue >> 40 ) & 0xff ) ; nowBytes [ 6 ] = ( byte ) ( ( nowValue >> 48 ) & 0xff ) ; nowBytes [ 7 ] = ( byte ) ( ( nowValue >> 56 ) & 0xff ) ; MessageDigest md = MessageDigest . getInstance ( "SHA" ) ; md . update ( nonce ) ; md . update ( nowBytes ) ; secret = md . digest ( ) ; } return secret ; }
protected for testing