help!

D

Debbie

what is the SK values in the given code?

X=f0ccaa0; Y=aaccf00;

*SK++ = ((X << 4) & 0x24000000) | ((X << 28) & 0x10000000)
| ((X << 14) & 0x08000000) | ((X << 18) & 0x02080000)
| ((X << 6) & 0x01000000) | ((X << 9) & 0x00200000)
| ((X >> 1) & 0x00100000) | ((X << 10) & 0x00040000)
| ((X << 2) & 0x00020000) | ((X >> 10) & 0x00010000)
| ((Y >> 13) & 0x00002000) | ((Y >> 4) & 0x00001000)
| ((Y << 6) & 0x00000800) | ((Y >> 1) & 0x00000400)
| ((Y >> 14) & 0x00000200) | ((Y ) & 0x00000100)
| ((Y >> 5) & 0x00000020) | ((Y >> 10) & 0x00000010)
| ((Y >> 3) & 0x00000008) | ((Y >> 18) & 0x00000004)
| ((Y >> 26) & 0x00000002) | ((Y >> 24) & 0x00000001);

*SK++ = ((X << 15) & 0x20000000) | ((X << 17) & 0x10000000)
| ((X << 10) & 0x08000000) | ((X << 22) & 0x04000000)
| ((X >> 2) & 0x02000000) | ((X << 1) & 0x01000000)
| ((X << 16) & 0x00200000) | ((X << 11) & 0x00100000)
| ((X << 3) & 0x00080000) | ((X >> 6) & 0x00040000)
| ((X << 15) & 0x00020000) | ((X >> 4) & 0x00010000)
| ((Y >> 2) & 0x00002000) | ((Y << 8) & 0x00001000)
| ((Y >> 14) & 0x00000808) | ((Y >> 9) & 0x00000400)
| ((Y ) & 0x00000200) | ((Y << 7) & 0x00000100)
| ((Y >> 7) & 0x00000020) | ((Y >> 3) & 0x00000011)
| ((Y << 2) & 0x00000004) | ((Y >> 21) & 0x00000002);

is it the SK perform as the below table?

Permuted Choice 2 (PC-2)

14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53
46 42 50 36 29 32
 
W

Walter Roberson

what is the SK values in the given code?
X=f0ccaa0; Y=aaccf00;
*SK++ = ((X << 4) & 0x24000000) | ((X << 28) & 0x10000000)
| ((X << 14) & 0x08000000) | ((X << 18) & 0x02080000) [etc]

is it the SK perform as the below table?
Permuted Choice 2 (PC-2)
14 17 11 24 1 5
[etc]

No. Examine the input dimensions and the expressions again.

There are two inputs (presumably hexadecimal even though you
did not use the right syntax for that), and there are two
expressions each of which produce a fixed calculation to
produce a single variable.

A moment's reflection on the code shows that the output will
be two *specific* values in the SK array -- and two *specific*
values is not going to be a 6 by 8 table of outputs.

Even if we suppose that the 6 x 8 table is to be read as one
vector of 48 elements, two elements is not going to match 48 elements.

If we take a clue from the subtitle "Permuted Choice", then we can
easily see that the code cannot possibly result in a permutation
of anything to give the results from the table: there are 48
table elements but there are entries with value greater than 48
so the table cannot represent a cycle of elements.



I thought my messages in response to your previous postings were
clear, but it appears that I should have been more explicit:


If you want us to be of assistance, then you must provide enough
context and enough explanation for us to understand what you are
asking.

Do not expect us to guess about anything: if you leave us to guess,
you risk the possibility that we do not have a clue what you are
trying to do, and the possibility that we infer mistaken conclusions
from small details and end up giving an incorrect or inapplicable
answer. [There is also the possibility that we might feel like being
deliberately obtuse if you don't seem to be learning from what we've
told you before.]

When you are posting a question, explain what you have already
figured out about solving the problem, and explain what you are
stuck on, and ask -specific- questions about the meanings of
things.

If you just post a question and do not seem to have any clue what
the question means, we will probably assume that you are posting a
homework assignment. When it comes to homework, we are happy to help
you learn -how- to do the work, but if it seems like you would just
be copying the answer without learning anything, then you might get
any kind of answer, including no answer, obscure answers, offers to
send the answer to your instructor, or answers deliberately
constructed such that if you were to copy them then your instructor
would easily detect that you did not do the work yourself.
 
D

Dave Thompson

what is the SK values in the given code?
X=f0ccaa0; Y=aaccf00;
*SK++ = ((X << 4) & 0x24000000) | ((X << 28) & 0x10000000)
| ((X << 14) & 0x08000000) | ((X << 18) & 0x02080000) [etc]

is it the SK perform as the below table?
Permuted Choice 2 (PC-2)
14 17 11 24 1 5
[etc]

No. Examine the input dimensions and the expressions again.

There are two inputs (presumably hexadecimal even though you
did not use the right syntax for that), and there are two
expressions each of which produce a fixed calculation to
produce a single variable.

A moment's reflection on the code shows that the output will
be two *specific* values in the SK array -- and two *specific*
values is not going to be a 6 by 8 table of outputs.

Even if we suppose that the 6 x 8 table is to be read as one
vector of 48 elements, two elements is not going to match 48 elements.

If we take a clue from the subtitle "Permuted Choice", then we can
easily see that the code cannot possibly result in a permutation
of anything to give the results from the table: there are 48
table elements but there are entries with value greater than 48
so the table cannot represent a cycle of elements.
Actually, his "Permuted Choice 2" is obviously from "DES" the (US
govt) Data Encryption Standard. (Formally it is no longer a standard;
following adoption of "AES" the Advanced Encryption Standard FIPS 197,
FIPS 46(-3) was withdrawn. The same _algorithm_ remains in Special Pub
800-67 but is now officially only DEA the Data Encryption Algorithm.
But with 30 years custom people continue to call it DES.)

This is a selection without replacement, hence reasonably if somewhat
archly called a permuted choice, of 48 _bits_ from 56 _bits_, numbered
one-origin. On the vast majority of platforms it is reasonable to keep
both input (adjusted key material) and output (Feistel round key) as
left and right halves in 32-bit (preferably unsigned) longs, in which
case code like what he shows is certainly reasonable, with the
correction you noted for hex literals although that is presumably just
an example since in practice your key (material) should never be
hardcoded. I haven't checked whether he has each bit exactly right. In
some uses it is best or at least good to (pre)generate all the round
keys in sequence, so storing them somewhere as *SK++ would make sense.

<snip: netiquette issues>

- David.Thompson1 at worldnet.att.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,812
Messages
2,569,694
Members
45,478
Latest member
dontilydondon

Latest Threads

Top