lprimak commented on issue #1022:
URL: https://github.com/apache/shiro/issues/1022#issuecomment-1875633907

   @sam2099 Good catch! I didn't see that one.
   I've filed a PR for that issue, but in the meanwhile you can use the code 
below:
   
   ```
   public class EncryptPasswordTest {
       @Test
       void encryptPassword() {
           DefaultPasswordService passwordService = new PasswordService();
           passwordService.setHashService(new HS());
           passwordService.setHashFormat(new Shiro1CryptFormat());
           System.out.println(passwordService.encryptPassword("hello123"));
       }
   
       private final static class PasswordService extends 
DefaultPasswordService {
           @Override
           protected HashRequest createHashRequest(ByteSource plaintext) {
               return new HashRequest.Builder().setSource(plaintext)
                       .setAlgorithmName(Sha256Hash.ALGORITHM_NAME)
                       .build();
           }
       }
   
       private final static class HS extends DefaultHashService {
           HS() {
               setDefaultAlgorithmName(Sha256Hash.ALGORITHM_NAME);
           }
       }
   }
   ```


-- 
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]

Reply via email to