2424import java .security .NoSuchAlgorithmException ;
2525import java .security .Provider ;
2626import java .security .Security ;
27- import org .slf4j .Logger ;
28- import org .slf4j .LoggerFactory ;
27+ import lombok .extern .slf4j .Slf4j ;
2928import org .tron .common .crypto .jce .TronCastleProvider ;
3029
30+ @ Slf4j
3131public class Hash {
32-
33- private static final Logger LOG = LoggerFactory .getLogger (Hash .class );
3432 private static final Provider CRYPTO_PROVIDER ;
3533
3634 private static final String HASH_256_ALGORITHM_NAME ;
@@ -46,7 +44,7 @@ public class Hash {
4644 try {
4745 sha256digest = MessageDigest .getInstance ("SHA-256" );
4846 } catch (NoSuchAlgorithmException e ) {
49- LOG .error ("Can't initialize HashUtils" , e );
47+ logger .error ("Can't initialize HashUtils" , e );
5048 throw new RuntimeException (e ); // Can't happen.
5149 }
5250
@@ -68,7 +66,7 @@ public static byte[] sha3(byte[] input) {
6866 digest .update (input );
6967 return digest .digest ();
7068 } catch (NoSuchAlgorithmException e ) {
71- LOG .error ("Can't find such algorithm" , e );
69+ logger .error ("Can't find such algorithm" , e );
7270 throw new RuntimeException (e );
7371 }
7472
@@ -83,7 +81,7 @@ public static byte[] sha3(byte[] input1, byte[] input2) {
8381 digest .update (input2 , 0 , input2 .length );
8482 return digest .digest ();
8583 } catch (NoSuchAlgorithmException e ) {
86- LOG .error ("Can't find such algorithm" , e );
84+ logger .error ("Can't find such algorithm" , e );
8785 throw new RuntimeException (e );
8886 }
8987 }
@@ -104,7 +102,7 @@ public static byte[] sha3(byte[] input, int start, int length) {
104102 digest .update (input , start , length );
105103 return digest .digest ();
106104 } catch (NoSuchAlgorithmException e ) {
107- LOG .error ("Can't find such algorithm" , e );
105+ logger .error ("Can't find such algorithm" , e );
108106 throw new RuntimeException (e );
109107 }
110108 }
@@ -117,7 +115,7 @@ public static byte[] sha512(byte[] input) {
117115 digest .update (input );
118116 return digest .digest ();
119117 } catch (NoSuchAlgorithmException e ) {
120- LOG .error ("Can't find such algorithm" , e );
118+ logger .error ("Can't find such algorithm" , e );
121119 throw new RuntimeException (e );
122120 }
123121 }
0 commit comments