0% found this document useful (0 votes)
4 views1 page

Exp 5 Css

The document contains a Java program that computes the MD5 hash of a given input string. It utilizes the MessageDigest class to generate the hash and outputs the result in hexadecimal format. There is an exception handling mechanism for cases where the MD5 algorithm is not found.

Uploaded by

madikim542
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Exp 5 Css

The document contains a Java program that computes the MD5 hash of a given input string. It utilizes the MessageDigest class to generate the hash and outputs the result in hexadecimal format. There is an exception handling mechanism for cases where the MD5 algorithm is not found.

Uploaded by

madikim542
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

import [Link].

MessageDigest;

import [Link] on;

public class Main {

public sta c void main(String[] args) {

String inputstring = "This is a message sent by a computer user.";

try {

// encoding the message using the library func on

MessageDigest md = [Link]("MD5");

[Link]([Link]());

byte[] digest = [Link]();

[Link]("Hash of the input string:");

StringBuilder hexString = new StringBuilder();

for (byte b : digest) {

String hex = [Link](0xff & b);

if ([Link]() == 1) [Link]('0');

[Link](hex);

[Link]([Link]());

} catch (NoSuchAlgorithmExcep on e) {

[Link]();

You might also like