Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Data Encryption Standard
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Pseudocode === [[Pseudocode]] for the DES algorithm follows. {{syntaxhighlight|lang=golang|code= // All variables are unsigned 64 bits // Pre-processing: padding with the size difference in bytes pad message to reach multiple of 64 bits in length var key // The keys given by the user var keys[16] var left, right // Generate Keys // PC1 (64 bits to 56 bits) key := permutation(key, PC1) left := (key rightshift 28) and 0xFFFFFFF right := key and 0xFFFFFFF for i from 1 to 16 do right := right leftrotate KEY_shift[i] left := left leftrotate KEY_shift[i] var concat := (left leftshift 28) or right // PC2 (56bits to 48bits) keys[i] := permutation(concat, PC2) end for // To decrypt a message reverse the order of the keys if decrypt do reverse keys end if // Encrypt or Decrypt for each 64-bit chunk of padded message do var tmp // IP chunk := permutation(chunk, IP) left := chunk rightshift 32 right := chunk and 0xFFFFFFFF for i from 1 to 16 do tmp := right // E (32bits to 48bits) right := expansion(right, E) right := right xor keys[i] // Substitution (48bits to 32bits) right := substitution(right) // P right := permutation(right, P) right := right xor left left := tmp end for // Concat right and left var cipher_chunk := (right leftshift 32) or left // FP cipher_chunk := permutation(cipher_chunk, FP) end for }}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)