[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
Solved

# (Programming) Inverse Permutation Function with a Secret Key (for cryptography).. I just need help understanding what to do

Posted on 2011-04-19
Medium Priority
670 Views
*full instructions in the attached picture*

I just have to program these two methods (just psuedo code)... but I'm not sure what to do with int[] z.

static char[] encrypt(char[] x, int[] z)
static char[] decrypt(char[] y, int[] z)

If i understand correctly...if I have an array of:

A B C D E

i would return

E D C B A

but i'm not sure what to do with the the Z array.

nocturn4l-446009.flv
0
Question by:nocturn4l
• 3
• 3

LVL 92

Expert Comment

ID: 35430131
sounds like you need to use z as an index of the element

so in your loop you would do something like:

``````encrypted[i] = x[z[i]];
``````
0

Author Comment

ID: 35430155
think i'm jus retarded... but do you think you can maybe elaborate further what you mean?  maybe using an example of the A B C D E example i gave?
0

Author Comment

ID: 35430160
for example, the encrypt function.. .the A B C D E would be passed into the function through the x array i believe.. but what would be in the z array then?
0

LVL 92

Accepted Solution

objects earned 2000 total points
ID: 35430184
> but what would be in the z array then?

array indexes, eg.

A B C D, 0 2 3 1 = A C D B
0

LVL 92

Expert Comment

ID: 35430202
0

Author Comment

ID: 35430208
ah ok i get it, thanks objects.   you've helped me in the past many times before.  i'll close the question when i finish just incase i have any other questions
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
###### Suggested Courses
Course of the Month20 days, 2 hours left to enroll