phxql / argon2-jvm

Argon2 Binding for the JVM
GNU Lesser General Public License v3.0
330 stars 32 forks source link

Where do we add salt ? #49

Closed rijulluman closed 6 years ago

rijulluman commented 6 years ago

Hi,

I am trying to add salt to Argon2d. I am not sure where I can pass the String/char[]/byte[] for salt... Sample code (Have specified salt length as 8 for "soemsalt"): Argon2 argon2 = Argon2Factory.create(Argon2Types.ARGON2d, 8, 32); String hash = null; String str = "password"; char[] passwordChar = str.toCharArray(); String salt = "somesalt";

    try {
        // Hash password
        hash = argon2.hash(2, 65536, 4, passwordChar);
        // Verify password
        if (argon2.verify(hash, password)) {
            // Hash matches password
        } else {
            // Hash doesn't match password
        }
    } finally {
        // Wipe confidential data
        argon2.wipeArray(passwordChar);
    } 

Also whats the version number parameter for this project by defalut ? Is it 13 ?

rijulluman commented 6 years ago

Please disregard. Covered in #19