PDoshi717791 (Community Member) asked a question.

Hello People,I am using SHA-256 for cryptographic security. When checkmarx scans the code, it gives below error.

"Use of a One Way Hash without a Salt"

I am using below code:

 

private static final String SALT = "hey neat, salt!";

 

MessageDigest md = MessageDigest.getInstance("SHA-256");

String forHashing = aDestination + SALT;

byte[] computedHash = md.digest(forHashing.getBytes());

String hash = encode(computedHash);

 

 

Any suggestions on what can be done to resolve this error ?

 

Thanks !

 


Topics (5)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.