
Explain how encryption secure passwords and write a program using either java or python of a hash function that can be used for passwords and give illustration to show how a hash function in cryptography works.

public class Main
{
public static void main(String[] args)
{
String passwordToHash = "password";
String generatedPassword = null;
try {
// Create MessageDigest instance for MD5
MessageDigest md = MessageDigest.getInstance("MD5");
//Add password bytes to digest
md.update(passwordToHash.getBytes());
//Get the hash's bytes
byte[] bytes = md.digest();
//This bytes[] has bytes in decimal format;
//Convert it to hexadecimal format
StringBuilder sb = new StringBuilder();
for(int i=0; i< bytes.length ;i++)
{
sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
}
//Get complete hashed password in hex format
generatedPassword = sb.toString();
}
catch (NoSuchAlgorithmException e)
{
e.printStackTrace();
}
System.out.println(generatedPassword);
}
}
Step by stepSolved in 2 steps

- Find out what risks are involved with the various authentication techniques and suggest a way to deal with the following situation.Bob uses a cryptographic hash function to check a password against a cache of other hashes.Bob performs a cryptographic hash on a password and checks it against a database of previously double-hashed passwords.arrow_forwardDefine hash as it relates to cryptography. Give one example of where a hash algorithm might be used. Name one specific hash algorithm.arrow_forward. Q: There is no authentication in the Diffie-Hellman key-exchange protocol. By exploiting this property, a malicious third party, Chuck, can easily break into the key exchange taking place between Alice and Bob, and subsequently ruin the security. Explain how this would work.arrow_forward
- Chapter 8: Problem 9 Previous Problem Problem List Next Problem Results for this submission Entered 49 146 Answer Preview Result 49 146 incorrect incorrect At least one of the answers above is NOT correct. (1 point) Alice and Bob are using the ElGamal cipher with the parameters p = 193 and a = = 5. = = Alice makes the mistake of using the same ephemeral key for two plaintexts, x1 and x 2. The eavesdropper Eve suspects that x1 146. She sees the two ciphertexts y1 = 141 and y2 = = 167 in transit; these are the encryptions of x1 and x2, respectively. a) What is the masking key kм? 49 b) What is the plaintext x2 ? 146arrow_forwardQuestion # 3 Assume that Dominique and Pricilla agreed to use an auto key cipher with initial keyvalue k1 = 11. Now Dominique wants to send Pricilla the following message“THE CLASS IS CANCELLED”. Encrypt the message before transmitting it over the Internet Remember: i need a Mathematics solution not computer program You must show all the steps of your workarrow_forwardFind out what risks are involved with the various authentication techniques and suggest a way to deal with the following situation.Bob uses a cryptographic hash function to check a password against a cache of other hashes.Bob performs a cryptographic hash on a password and checks it against a database of previously double-hashed passwords.arrow_forward
- Computer Science Assume we use transposition cipher to encrypt the data, and the original message is stored in a 8 by 5 matrix (8 rows and 5 columns). If the ciphertext is shown below, what is the original plaintext?WMHPSCATEEEUCELELTCTIASLOTMRNCAarrow_forwardA typical hash function often consists of the following three steps:arrow_forwardCorrect answer will be Upvoted else downvoted. Thank you! Monoalphabetic ciphers are stronger than Polyalphabetic ciphers because frequency analysis is tougher on the former. i) True ii) Falsearrow_forward
- In RSA encryption, if the public key is 299, what is the private key? (Enter your answers as a comma-separated list.)arrow_forwardAsymmetric ciphers' unreversible operations make them more secure. This chapter covered various asymmetric operations. What asymmetric operations can you think of?arrow_forwardExplain Thwarting Output-Guessing Attacks in Logic Encryption.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





