Is SHA-256 backward compatible with SHA ?
807588Jul 5 2006 — edited Mar 2 2009All user password is SHA encrypted before being stored in Oracle database ( varchar2). When a user inputs there userID and password, I SHA encrypt the entered password and compare it with the password in the database as validation.
I would like to change to using SHA-256 ( a requirement by Audit ). How would I handle converting all existing SHA encrypted password to SHA-256? I don't think SHA and SHA-256 is backward compatible as the existing SHA password is much smaller in length compared to the entered password converted to SHA-256.
Thank you for your help.
This is the existing code that I would like to modify to use SHA-256
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] hash = md.digest(rawPassword);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
Base64Encoder encoder = new Base64Encoder(new ByteArrayInputStream(hash), bout);
encoder.process();
String hashpw = "{SHA}" + bout.toString();
return hashpw.getBytes();