Example usage for org.apache.commons.codec.digest DigestUtils sha1Hex

List of usage examples for org.apache.commons.codec.digest DigestUtils sha1Hex

Introduction

In this page you can find the example usage for org.apache.commons.codec.digest DigestUtils sha1Hex.

Prototype

public static String sha1Hex(String data) 

Source Link

Usage

From source file:com.davisNyandiri.Beans.AdminController.java

public String addMember() {
    Admin admin = new Admin();

    String userPassword = adminBean.getEmail();
    try {/*from  www. jav a 2 s. com*/

        admin.setEmail(adminBean.getEmail());
        admin.setPassword(DigestUtils.sha1Hex(userPassword));

        adminfacade.create(admin);

        return "success_registration";

    } catch (Exception e) {
        return null;
    }

}

From source file:com.nextdoor.bender.handler.s3.S3InternalEventTest.java

@Test
public void testAppendFilename() {
    TestContext context = new TestContext();
    context.setAwsRequestId("req_id");
    S3InternalEvent ievent = new S3InternalEvent("foo", new LambdaContext(context), 0, "file", "bucket", "v1");

    ievent.setEventObj(null);/*from w  w  w.  ja  v a2  s.c  o m*/

    Map<String, String> expected = new HashMap<String, String>(1);
    expected.put(S3InternalEvent.FILENAME_PARTITION, DigestUtils.sha1Hex("file"));

    assertEquals(expected, ievent.getPartitions());
}

From source file:dbtool.login.LoginController.java

@FXML
protected void btn_login_click(MouseEvent event) {
    if (this.LoginImpl == null) {
        this.LoginImpl = new LoginImpl();
    }//ww w.  j a v  a 2 s.co  m
    try {
        if (this.LoginImpl.checkLogin(tf_username.getText().trim(),
                DigestUtils.sha1Hex(tf_password.getText().trim()))) {
            System.out.println("Login successfull");
            this.myController.setScreen(dbtool.DBTool.MENU_SCREEN_ID);

        } else {
            this.lbl_message.setText("Falsches Passwort oder Benuzername");
        }
    } catch (SQLException ex) {
        Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, "Exception during login: ", ex);
        this.lbl_message.setText("Es ist ein Fehler mit der Datenbank aufgetreten");
    }
}

From source file:io.fabric8.elasticsearch.plugin.acl.BaseRolesSyncStrategyTest.java

@Test
public void testFormatUserNameRoleThatHasForwardSlash() {
    assertEquals("gen_user_" + DigestUtils.sha1Hex("test/user"), formatUserRoleName("test/user"));
}

From source file:controller.model.ControllerPsUsuarios.java

public PsUsuarios crearUsuarios(String[] argsUsuario) {
    controllerFecha = new ControllerFecha();
    PsUsuarios psUsuarios;//from  w  w  w.ja  v a2  s  . c  om

    if (!argsUsuario[0].equals("") && !argsUsuario[1].equals("") && !argsUsuario[2].equals("")
            && !argsUsuario[3].equals("") && !argsUsuario[4].equals("") && !argsUsuario[5].equals("")) {
        if (argsUsuario[3].length() >= 5) {

            psUsuarios = new PsUsuarios();
            psUsuarios.setNombres(argsUsuario[0]);
            psUsuarios.setApellidos(argsUsuario[1]);
            psUsuarios.setUsuario(argsUsuario[2]);
            psUsuarios.setPassword(DigestUtils.sha1Hex(argsUsuario[3]));
            psUsuarios.setEmpresa(argsUsuario[4]);
            psUsuarios.setRol(argsUsuario[5]);
            psUsuarios.setFechaCreacion(controllerFecha.getFecha());
            psUsuarios.setFechaModificacion(controllerFecha.getFecha());

            return psUsuarios;
        }
        JOptionPane.showMessageDialog(null, "La contrasea debe tener como minimo 5 caracteres");

    } else {
        JOptionPane.showMessageDialog(null, "Por favor complete todos los campos");
        return null;
    }
    return null;
}

From source file:be.fedict.hsm.ws.impl.NamePasswordCallbackHandler.java

public NamePasswordCallbackHandler(byte[] encodedCertificate) {
    this.name = DigestUtils.sha1Hex(encodedCertificate);
    this.password = Hex.encodeHex(encodedCertificate);
}

From source file:com.wallellen.wechat.common.util.crypto.SHA1.java

/**
 * &arr??sha1 digest/* w  w  w  .  j  a  va 2  s.c o m*/
 *
 * @param arr
 * @return
 */
public static String genWithAmple(String... arr) throws NoSuchAlgorithmException {
    Arrays.sort(arr);
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < arr.length; i++) {
        String a = arr[i];
        sb.append(a);
        if (i != arr.length - 1) {
            sb.append('&');
        }
    }
    return DigestUtils.sha1Hex(sb.toString());
}

From source file:com.monitor.baseservice.utils.XCodeUtil.java

public static String getSHA1(String data) {
    return DigestUtils.sha1Hex(data);
}

From source file:net.mohatu.bloocoin.miner.Register.java

private void genData() {
    Random r = new Random(), w = new Random();
    addr = DigestUtils.sha1Hex((randomString() + r.nextInt(Integer.MAX_VALUE)).toString()).toString();
    key = DigestUtils.sha1Hex((randomString() + w.nextInt(Integer.MAX_VALUE)).toString()).toString();
    System.out.println("Addr: " + addr + "\nKey: " + key);
}

From source file:net.mohatu.bloocoin.miner.RegCustom.java

private void genData() {
    Random r = new Random();
    key = DigestUtils.sha1Hex((randomString() + r.nextInt(Integer.MAX_VALUE)).toString()).toString();
    System.out.println("Addr: " + addr + "\nKey: " + key);
}