We have an application where we are converting a credit card number into a hashstring for storing it into the database. We have started facing an issue where Base64.encodeBase64(byte[]) is returning different byte[] output for same input byte[]. The issue is random, sometimes it generates same and other times it returns different. Also we are observing this on a specific environment only.
Pseudo code steps;
- String ccNumber = “4111123423453456”;
- Concatenating salt to the above string and then generating the byte array with a specific encoding
- Update the byte[] with the Digest
- Apply the Base64.encodeBase64 on the updated byte[]
- The result which comes out varies at times, inspite of same input byte[]
Please help.