LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-27-2012, 11:04 AM   #1
Lsatenstein
Member
 
Registered: Jul 2005
Location: Montreal Canada
Distribution: Fedora Core 6 XEN
Posts: 194
Blog Entries: 1

Rep: Reputation: 36
What is the correct way Making a DES key respect Parity?


In the algorithms for DES, it is stipulated that the keys are 56 bits in length, from a string of 64 bits (8 bytes).

rule 1 has the high order bit (0x80)toggled to make the parity of the byte odd.
This rule would change byte bits 00000011 to 10000011 (0x03|0x80);

rule 2 says to toggle the left most bit following the previous 1.
Here is a visual example of what is meant.
bits 00000011 (the value 0x03). The rule would change this to
bits 00000111 (the value 0x07). (0x03|0x04).

The latter would be implemented with a 256 byte table. The former with a
16 byte table.


Are there other options? Of the two methods indicated above, what is the correct one?
 
Old 08-28-2012, 08:59 AM   #2
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,267

Rep: Reputation: 1086Reputation: 1086Reputation: 1086Reputation: 1086Reputation: 1086Reputation: 1086Reputation: 1086Reputation: 1086
Either of the two.

The second rule, if mutually agreeable, is a slightly better rune for quickly detecting transmission errors.

In most pragmatic implementations that I have lately seen, this technique isn't used. The 56-bit key is exchanged in a packet that includes a true CRC checksum of the key material. Even an 8-bit CRC applied to 56 bits of data is much more likely to detect a garbled key than a byte-wise parity check. But it's more complex for a hardware device to perform, and if the DES implementation is in a hardware chip, the rules of that chip must in any case be followed.

Last edited by sundialsvcs; 08-28-2012 at 09:04 AM.
 
Old 09-02-2012, 02:17 AM   #3
Lsatenstein
Member
 
Registered: Jul 2005
Location: Montreal Canada
Distribution: Fedora Core 6 XEN
Posts: 194
Blog Entries: 1

Original Poster
Rep: Reputation: 36
Thank you for you feedback.

The 3DES software I used actually uses a mapping of bits 1-7 of each byte, so it matters not if I use the 0x80 toggle. As for the rule 2, It is really changing the key value, and I cant see why I should do it too.

Best to just take the encryption key as the 3*8 bytes and let the algorithm sort it out.
 
  


Reply

Tags
3des, des, encryption, parity


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to generate DES key for using with tacacs+ in Fedora 8 cezaronne Linux - Newbie 4 10-25-2012 09:06 AM
[SOLVED] Why can't I authenticate my wireless WEP Key (even though it is correct) DaveEnfield Linux - Wireless Networking 4 02-14-2011 07:05 PM
LXer: Making sure you have the correct PHP class or function LXer Syndicated Linux News 0 06-24-2009 08:00 AM
Making sure the correct kernel headers are used djgerbavore Fedora 2 09-06-2007 08:52 AM
Making Correct Partition ciyan Linux - Newbie 5 02-21-2005 06:45 AM


All times are GMT -5. The time now is 06:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration