Skip to content
Browse files

adding TEST_KEY

  • Loading branch information...
1 parent a6a0a78 commit 05cc7d068aa98224963611e47518a56ad8b7913f Robert Sosinski committed Jul 28, 2008
Showing with 33 additions and 1 deletion.
  1. +20 −0 lib/ruby-des.rb
  2. +6 −0 lib/ruby-des/feistel.rb
  3. +7 −1 lib/ruby-des/key_schedule.rb
View
20 lib/ruby-des.rb
@@ -22,7 +22,27 @@ module RubyDES
0x22, 0x02, 0x2a, 0x0a, 0x32, 0x12, 0x3a, 0x1a,
0x21, 0x01, 0x29, 0x09, 0x31, 0x11, 0x39, 0x19]
+ # The binary representation of "ruby-des" with proper parity."
+ TEST_KEY = ["1", "1", "1", "0", "0", "1", "0", "1",
+ "1", "1", "1", "0", "1", "0", "1", "0",
+ "1", "1", "0", "0", "0", "1", "0", "0",
+ "1", "1", "1", "1", "0", "0", "1", "0",
+ "0", "1", "0", "1", "1", "0", "1", "1",
+ "1", "1", "0", "0", "1", "0", "0", "0",
+ "1", "1", "0", "0", "1", "0", "1", "1",
+ "1", "1", "1", "0", "0", "1", "1", "0"]
+
class Ctx
+ def self.new(block, key)
+
+ end
+
+ def encrypt
+
+ end
+ def decrypt
+
+ end
end
end
View
6 lib/ruby-des/feistel.rb
@@ -57,5 +57,11 @@ class Feistel
0x07, 0x0b, 0x04, 0x01, 0x09, 0x0c, 0x0e, 0x02, 0x00, 0x06, 0x0a, 0x0d, 0x0f, 0x03, 0x05, 0x08,
0x02, 0x01, 0x0e, 0x07, 0x04, 0x0a, 0x08, 0x0d, 0x0f, 0x0c, 0x09, 0x00, 0x03, 0x05, 0x06, 0x0b]
+ def self.new(half_block, sub_key, round)
+
+ end
+ def run
+
+ end
end
View
8 lib/ruby-des/key_schedule.rb
@@ -9,6 +9,8 @@ class KeySchedule
0x0e, 0x06, 0x3d, 0x35, 0x2d, 0x25, 0x1d,
0x15, 0x0d, 0x05, 0x1c, 0x14, 0x0c, 0x04]
+ PC_1 = PC_1_L + PC_1_R
+
PC_2 = [0x0e, 0x11, 0x0b, 0x18, 0x01, 0x05,
0x03, 0x1c, 0x0f, 0x06, 0x15, 0x0a,
0x17, 0x13, 0x0c, 0x04, 0x1a, 0x08,
@@ -21,5 +23,9 @@ class KeySchedule
ROTATIONS = [1, 1, 2, 2, 2, 2, 2, 2,
1, 2, 2, 2, 2, 2, 2, 1]
-
+ def self.create(key)
+
+
+ return sub_keys
+ end
end

0 comments on commit 05cc7d0

Please sign in to comment.
Something went wrong with that request. Please try again.