- import import import import import java.nio.ByteBuffer java.util.Arrays - import import import import import...

This preview shows page 1 - 2 out of 5 pages.

import; import java.nio.ByteBuffer; import; import; import java.util.Arrays; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class Block_cipher { public static void main(String[] args) { byte[] k = { (byte) 0xFD, (byte) 0xE8, (byte) 0xF7, (byte) 0xA9, (byte) 0xB8, 0x6C, 0x3B, (byte) 0xFF, (byte) 0x07, (byte) 0xC0, (byte) 0xD3, (byte) 0x9D, (byte) 0x04, (byte) 0x60, (byte) 0x5E, (byte) 0xDD }; byte[] iv = { (byte) 0xFD, (byte) 0xE8, (byte) 0xF7, (byte) 0xA9, (byte) 0xB8, 0x6C, 0x3B, (byte) 0xFF, (byte) 0x07, (byte) 0xC0, (byte) 0xD3, (byte) 0x9D, (byte) 0x04, (byte) 0x60, (byte) 0x5E, (byte) 0xDD }; byte[] nonce = { (byte) 0xFD, (byte) 0xE8, (byte) 0xF7, (byte) 0xA9, (byte) 0xB8, 0x6C, 0x3B, (byte) 0xFF, (byte) 0x07, (byte) 0xC0, (byte) 0xD3, (byte) 0x9D, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; String plantext = "The top half of the workspace consists of an arrangement of other existing components to calculate an MD5-HMAC. " + "These individual components are labelled to show which part of the final HMAC output they generate." + " In order for this arrangement to generate a correct result, the HMAC key chosen must have a length of exactly 64 bytes."; byte[] PlainText = null; try { PlainText = plantext.getBytes("ASCII"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Key : " + byteArrayToHex(k)); System.out.println("iv : " + byteArrayToHex(iv)); System.out.println("nonce : " + byteArrayToHex(nonce)); System.out.println();
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 5 pages?

  • Summer '17
  • Cryptography, Block cipher, CBC, TODO Auto-generated catch, 64 bytes

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes