Course Hero Logo
Question
Answered step-by-step

Hi! I need help with this. Generate Checksum: Refactor the code to...

Hi! I need help with this.

Generate Checksum: Refactor the code to encrypt a text string and generate a checksum verification. First, download the code base and upload it to Eclipse as a new project. Refactor the code to add your first and last name as a unique data string. You will submit your refactored code for your instructor to review. Then generate the checksum by following these steps:

  1. Create an object of MessageDigest class using the java.security.MessageDigest library.
  2. Initialize the object with your selection for an appropriate algorithm cipher.
  3. Use the digest() method of the class to generate a hash value of byte type from the unique data string (your first and last name).
  4. Convert the hash value to hex using the bytesToHex function.
  5. Create a RESTFul route using the @RequestMapping method to generate and return the required information, which includes the hash value, to the web browser.




The code as below.

package com.snhu.sslserver;


import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;




@SpringBootApplication

public class ServerApplication {


public static void main(String[] args) {

SpringApplication.run(ServerApplication.class, args);

}


}


@RestController

class ServerController{

//FIXME: Add hash function to return the checksum value for the data string that should contain your name. 

  @RequestMapping("/hash")

  public String myHash(){

   String data = "Hello Christopher Holmes!";

    

    return "<p>data:"+data;

  }

}

Answer & Explanation
Verified Solved by verified expert
Rated Helpful

icitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce du

o. Donec aliquet. Lorem ipsum

facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem

Unlock full access to Course Hero

Explore over 16 million step-by-step answers from our library

Subscribe to view answer
Step-by-step explanation
, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus ef