Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

I need help completing my assignment for COMP2300: Applied Cryptography. There are two parts that need to be completed. Part 1 is a little exercise based on attacking a hash function. The expert will...

1 answer below »
I need help completing my assignment for COMP2300: Applied Cryptography. There are two parts that need to be completed. Part 1 is a little exercise based on attacking a hash function. The expert will need to create a class called JHTest, then paste the following code into it and answer two questions related to part 1. Part 2 is calculating a digest over a file. Part 2 requires completing the program by filling the missing code which initiates objects of the right classes and then calls the appropriate method calls. The expert will then need to answer question 3, 4, and 5 related to part 2. All the information related to the assignment is inCOMP2300_SHFYR_2021_ALL_U_ Assignment 1 - File Digests with the Java Cryptography Architecture. The questions for both part 1 and 2 need to be answered in Assignment1.txt. FileProperty needs to be imported into Eclipse.
Answered 1 days After Sep 04, 2021 COMP 2300

Solution

Vibhav answered on Sep 05 2021
170 Votes
Hmacsha256/1.PNG
Hmacsha256/2.PNG
Hmacsha256/FileProperty.java
Hmacsha256/FileProperty.java
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.security.InvalidKeyException;
import java.security.Key;
**
 * Program to calculate a security property of a file, 
 * consisting of SHA3-256 (or other) digest over the file, 
 * prefixed with a shared secret
 *
**
 * @author  
 *
 *
public class FileProperty {
    
    private static final String progName = "FileProperty";      
 Name of the program
    private static final int bufSize = 512;                 
 Almost any sensible value will work here
    /**
     * @param args
     *
    public static void main(String[] args) {
        
        BufferedInputStream in = null;          
 A buffered input stream to read from
        byte[] inputBuffer = new byte[bufSize]; 
 A buffer for the input read from the file
        int bytesRead = 0;                      
 Number of bytes read into the input file buffe
        byte[] messageDigest = null;            
 A variable for the actual digest value, as an a
ay of bytes
        
        
 First, check the user has provided all the required arguments, and if they haven't, tell them then exit
        if(args.length != 2) {
            printUsageMessage(); System.exit(1);
        }
        
 Open the input file
        try {
            in =...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here