AuthMe Reloaded

AuthMe Reloaded

3M Downloads

Can't use Custom (Salted) hashing

zNoah-1 opened this issue ยท 0 comments

commented

What behaviour is observed?

When using Custom hashing, you can login, but when trying to register it throws NullPointerException.

It happens on beta2 and latest commit

Expected behaviour

Plugin working normally (Login and Register without any issues)

To Reproduce

Set Custom hash on config
Create a plugin with that custom hash
Try to register a new user

This is my main class:

package zkyubz.utilities.spigot.authme_dba;

import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import zkyubz.utilities.spigot.authme_dba.listeners.HashEvent;

public class ADPlugin extends JavaPlugin {
    @Override
    public void onEnable(){
        PluginManager pluginManager = getServer().getPluginManager();

        if (pluginManager.isPluginEnabled("AuthMe")){
            pluginManager.registerEvents(new HashEvent(), this);
            System.out.println("Authme detected");
        }

        else {
            System.out.println("Authme not found ):");
        }
    }
}

This is my listener:

package zkyubz.utilities.spigot.authme_dba.listeners;

import fr.xephi.authme.events.PasswordEncryptionEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import zkyubz.utilities.spigot.authme_dba.crypto.Dba_Sha512;

public class HashEvent implements Listener {
    @EventHandler()
    public void onEncrypt(PasswordEncryptionEvent event){
        event.setMethod(new Dba_Sha512());
    }
}

This is my HashMethod:

package zkyubz.utilities.spigot.authme_dba.crypto;

import fr.xephi.authme.security.HashUtils;
import fr.xephi.authme.security.crypts.SeparateSaltMethod;
import fr.xephi.authme.security.crypts.description.Recommendation;
import fr.xephi.authme.security.crypts.description.Usage;
import fr.xephi.authme.util.RandomStringUtils;

@Recommendation(Usage.RECOMMENDED)
public class Dba_Sha512 extends SeparateSaltMethod {

    @Override
    public String computeHash(String password, String salt, String name) {
        String hashedPass = HashUtils.sha512(password);
        return HashUtils.sha512(hashedPass + salt);
    }

    @Override
    public String generateSalt() {
        return RandomStringUtils.generateHex(32);
    }
}

Plugin list

Authme

Server Implementation

Standalone server (no proxy)

Database Implementation

MySQL

AuthMe Version

AuthMeReloaded v5.6.0-Snapshot (Tried beta2 and latest git)

Error log (if applicable)

https://gist.github.com/zNoah-1/f6df30052e10c90650cac0f65f6c84f4

Configuration

https://gist.github.com/zNoah-1/dd44870bb1826a1a5e736e7fc3073b55