lprimak commented on issue #1022:
URL: https://github.com/apache/shiro/issues/1022#issuecomment-1868225958
Hi,
I believe I have a solution to your problem, and it's very simple.
HOWEVER: I highly recommend not to do this, but to encrypt the passwords to
the new `argon2` format
You just need to add `passwordService.setHashFormat(new
Shiro1CryptFormat());` to your code
Full example:
```
public class EncryptTest {
@Test
void encryptPassword() {
DefaultPasswordService passwordService = new
DefaultPasswordService();
passwordService.setHashService(new HS());
passwordService.setHashFormat(new Shiro1CryptFormat());
System.out.println(passwordService.encryptPassword("hello123"));
}
private final static class HS extends DefaultHashService {
HS() {
setDefaultAlgorithmName("SHA-256");
}
}
}
```
I am going to close this issue, if the fix doesn't work, please feel free to
re-open it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]