<commit_before>package org.jcryptool.visual.sig.algorithm;

import java.security.*;
//import javax.crypto.*;

/**
 * Hashes the given input with one of the selected hash methods.
 * @author Grebe
 *
 */
public class Hash {
	private String hashmethod;
	/**
	 * @return the hashmethod
	 */
	public String getHashmethod() {
		return hashmethod;
	}

	/**
	 * @param hashmethod the hashmethod to set
	 */
	public void setHashmethod(String hashmethod) {
		this.hashmethod = hashmethod;
	}

	public static String hash;
	
	/**
	 * Standard constructor that sets the default method
	 */
	public Hash () {
		hashmethod = "MD5"; //MD5
	}
	
	/**
	 * Constructor that sets hash method and the input
	 */
	public Hash (String hashmethod) {
		hashmethod = this.hashmethod;
	}

	public void hashInput () throws Exception {
		//Get input:
		byte[] input = org.jcryptool.visual.sig.algorithm.Input.data; //Contains the input (a file or plain text)
		//Get an MD5 message digest object and compute the plaintext digest
	    MessageDigest messageDigest = MessageDigest.getInstance(hashmethod); //Argument is a string!
	    messageDigest.update(input);
	    //Output:
	    byte[] md = messageDigest.digest();
	    //Test
	    hash = new String(md, "UTF8");
	    hash = new String (bytesToHex(md));
	    //Test: recreate the message digest from the plaintext
	}
    
	//To display the sting in hex
	public static String bytesToHex(byte[] bytes) {
	    final char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
	    char[] hexChars = new char[bytes.length * 2];
	    int v;
	    for ( int j = 0; j < bytes.length; j++ ) {
	        v = bytes[j] & 0xFF;
	        hexChars[j * 2] = hexArray[v >>> 4];
	        hexChars[j * 2 + 1] = hexArray[v & 0x0F];
	    }
	    return new String(hexChars);
	}

}
<commit_msg>Update Hash.java<commit_after>package org.jcryptool.visual.sig.algorithm;

import java.security.*;
//import javax.crypto.*;

/**
 * Hashes the given input with one of the selected hash methods.
 * @author Grebe
 *
 */
public class Hash {
	private String hashmethod;
	/**
	 * @return the hashmethod
	 */
	public String getHashmethod() {
		return hashmethod;
	}

	/**
	 * @param hashmethod the hashmethod to set
	 */
	public void setHashmethod(String hashmethod) {
		this.hashmethod = hashmethod;
	}

	public static String hash;
	
	/**
	 * Standard constructor that sets the default method
	 */
	public Hash () {
		hashmethod = "MD5"; //MD5
	}
	
	/**
	 * Constructor that sets hash method and the input
	 */
	public Hash (String hashmethod) {
		hashmethod = this.hashmethod;
	}

	public void hashInput () throws Exception {
		//Get input:
		byte[] input = org.jcryptool.visual.sig.algorithm.Input.data; //Contains the input (a file or plain text)
		//Get an MD5 message digest object and compute the plaintext digest
	    MessageDigest messageDigest = MessageDigest.getInstance(hashmethod); //Argument is a string!
	    messageDigest.update(input);
	    //Output:
	    byte[] md = messageDigest.digest();
	    //Test
	    hash = new String(md, "UTF8");
	    hash = new String (bytesToHex(md));
	    org.jcryptool.visual.sig.algorithm.Input.hash = md;
	    //Test: recreate the message digest from the plaintext
	}
    
	//To display the sting in hex
	public static String bytesToHex(byte[] bytes) {
	    final char[] hexArray = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
	    char[] hexChars = new char[bytes.length * 2];
	    int v;
	    for ( int j = 0; j < bytes.length; j++ ) {
	        v = bytes[j] & 0xFF;
	        hexChars[j * 2] = hexArray[v >>> 4];
	        hexChars[j * 2 + 1] = hexArray[v & 0x0F];
	    }
	    return new String(hexChars);
	}

}

{'fraction_non_alphanumeric': 0.14204545454545456, 'fraction_numerical': 0.012445887445887446, 'mean_word_length': 3.0054171180931744, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3752775', 'n_tokens_mistral': 1277, 'n_tokens_neox': 1157, 'n_words': 357}