Polish crypto format

Issue gh-8945
This commit is contained in:
Rob Winch 2020-08-24 09:48:23 -05:00
parent 4fd67b48e0
commit a662a5593e
1 changed files with 9 additions and 2 deletions

View File

@ -84,8 +84,15 @@ public class Argon2PasswordEncoder implements PasswordEncoder {
public String encode(CharSequence rawPassword) {
byte[] salt = this.saltGenerator.generateKey();
byte[] hash = new byte[this.hashLength];
Argon2Parameters params = new Argon2Parameters.Builder(Argon2Parameters.ARGON2_id).withSalt(salt)
.withParallelism(this.parallelism).withMemoryAsKB(this.memory).withIterations(this.iterations).build();
// @formatter:off
Argon2Parameters params = new Argon2Parameters
.Builder(Argon2Parameters.ARGON2_id)
.withSalt(salt)
.withParallelism(this.parallelism)
.withMemoryAsKB(this.memory)
.withIterations(this.iterations)
.build();
// @formatter:on
Argon2BytesGenerator generator = new Argon2BytesGenerator();
generator.init(params);
generator.generateBytes(rawPassword.toString().toCharArray(), hash);