mirror of
https://github.com/kristoferssolo/des-rs.git
synced 2026-02-25 04:58:17 +00:00
feat: finish pc1 implementation
This commit is contained in:
@@ -13,20 +13,22 @@ pub const FP: [u8; 64] = [
|
||||
34, 2, 42, 10, 50, 18, 58, 26, 33, 1, 41, 9, 49, 17, 57, 25,
|
||||
];
|
||||
|
||||
/// PC1 table (64 to 56 bits).
|
||||
pub const PC1: [u8; 64] = [
|
||||
/// Key Permutation table (64 to 56 bits).
|
||||
pub const PC1_TABLE: [u8; 56] = [
|
||||
57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60,
|
||||
52, 44, 36, 28, 20, 12, 4, 61, 53, 45, 37, 29, 21, 13, 5, 62, 54, 46, 38, 30, 22, 14, 6, 63,
|
||||
55, 47, 39, 31, 23, 15, 7, 0, 0, 0, 0, 0, 0, 0, 0, // Parity bits skipped
|
||||
52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29,
|
||||
21, 13, 5, 28, 20, 12, 4,
|
||||
];
|
||||
|
||||
/// PC2 table (56 to 48 bits).
|
||||
pub const PC2: [u8; 56] = [
|
||||
/// Compression Permutation table (56 to 48 bits).
|
||||
pub const PC2_TABLE: [u8; 48] = [
|
||||
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, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, // Parity bits skipped
|
||||
31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32,
|
||||
];
|
||||
|
||||
/// Number of Key Bits Shifted per Round
|
||||
pub const ROUND_ROTATIONS: [u8; 16] = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];
|
||||
|
||||
/// Expansion permutation (32 to 48 bits).
|
||||
pub const EXPANSION: [u8; 48] = [
|
||||
32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18,
|
||||
|
||||
Reference in New Issue
Block a user