Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java /** * Computes the next bit of LFSR. * @param arr the bit array (initially the seed) * @param coefs the binary coefficients *

Java

/** * Computes the next bit of LFSR. * @param arr the bit array (initially the seed) * @param coefs the binary coefficients * @return a boolean the combination of adding the multiplication of each bit with a coefficient */ static boolean feedbackLfsr(boolean[] arr, boolean[] coefs) { boolean ret = arr[arr.length-1] && coefs[0]; for (int i=1; i< arr.length; i++) { ret ^= arr[arr.length-1-i] && coefs[i]; } return ret; }

/** * Computes the next state of the bit array. * @param arr the bit array (initially the seed) * @param coefs the binary coefficients * @return the next bit to use for encoding. */ static boolean feedbackUpdateLfsr(boolean[] arr, boolean[] coefs) { throw new java.lang.UnsupportedOperationException(); } /** * Encode the char by XORing each bit with the returned one from feedbackUpdateLFSR. * @param c the char to encode * @param arr the bit array (initially the seed) * @param coefs the binary coefficients * @return the encoded char */ static char encodeCharLfsr(char c, boolean[] arr, boolean[] coefs) { throw new java.lang.UnsupportedOperationException(); }

/** * Encode the char array by encoding each char in it. * @param chars the char array to encode * @param arr the bit array (initially the seed) * @param coefs the binary coefficients * @return the encoded char */ static char[] encodeCharArrayLfsr(char[] chars, boolean[] arr, boolean[] coefs) { throw new java.lang.UnsupportedOperationException(); }

/** * Test the LFSR encoding and decoding. * 1. copy the bit array (the seed) and put aside * 2. Transform the text into a char array * 3. Encode using encodeCharArrayLFSR and print * 4. Decode the encoded message using the copied seed and encodeCharArrayLFSR and print * @param text the text to test * @param arr the bit array (initially the seed) * @param coefs the binary coefficients */ static void testLfsr(String text, boolean[] arr, boolean[] coefs) { throw new java.lang.UnsupportedOperationException(); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions