Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with implementing A5/1 stream cipher in R programming. I understand the theoretical concept of it, but do not know how to program

I need help with implementing A5/1 stream cipher in R programming. I understand the theoretical concept of it, but do not know how to program it. Can someone walk me through an example of doing this algorithm in R programming? I'm new to R so please keep it simple thank you. I have to follow the steps below.

1. Find the 8 bit binary number for the following characters: A, t, @, 17, 9, & [hint: use binary() in package compositions].

2. Find the decimal numbers for the following: "00010110", "00011101", "01011011", "01100101", "00001010", "01100100".

3. For the seed: "MHID9870" a) Create the UTF8 encoding. b) Create the 8 bit binary form for the results of a). c) Split the strings into individual bits. d) Unlist the result of c). e) Put the results of d) into one integer vector.

4. Fill three variables x, y, and z with the results of 3 such that x gets the first 19, y gets the next 22, and z gets the last 23 bits. Initialize an integer vector k of length 128.

5. Find the majority value for x[9], y[11] and z[11].

6. Write code for the following: if x steps then shift x to the right by 1 bit. Next assign the appropriate value to x[1]. Do the same for y and z.

7. Create key stream bit by XOR-in the appropriate bits from x, y, and z vectors.

8. Write a function for the above and create a 128 bit key stream with the seed mentioned in question 3. You function should contain two parameters: a seed and a key length.

I have already completed steps 1-4.

install.packages('compositions')

library(compositions)

utf8ToInt('A')

binary(65, mb=7)

utf8ToInt('t')

binary(116, mb=7)

utf8ToInt('@')

binary(64, mb=7)

binary(17, mb=7)

binary(9, mb=7)

utf8ToInt('&')

binary(38, mb=7)

unbinary('00010110')

unbinary('00011101')

unbinary('01011011')

unbinary('01100101')

unbinary('00001010')

unbinary('01100100')

VEC <- utf8ToInt('MHID9870')

BIN <- binary(VEC, mb=7)

BIN

splitting0 <- strsplit(BIN, "")

splitting0

CHAR0 <- unlist(strsplit(BIN, ""))

CHAR0

xr <- as.integer(c(CHAR0))

x <- xr[1:19]

x

y <- xr[20:41]

y

z <- xr[21:64]

z

k <- vector(mode='integer', length = 128)

k

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Conduct a needs assessment. page 269

Answered: 1 week ago