Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javafxapplication1;
- import java.security.MessageDigest;
- import java.security.NoSuchAlgorithmException;
- /**
- *
- * @author as
- */
- public class haslo {
- public static String haszuj(String pass) throws NoSuchAlgorithmException
- {
- //String pass = passwordField.getText();
- // String username = usernameField.getText();
- String passwordToHash = pass;
- String generatedPassword = null;
- MessageDigest md = MessageDigest.getInstance("MD5");
- md.update(passwordToHash.getBytes());
- byte[] bytes = md.digest();
- StringBuilder sb = new StringBuilder();
- for(int i=0; i< bytes.length ;i++)
- {
- sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
- }
- return generatedPassword = sb.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement