Browse Subversion Repository
Diff of /branches/mty-makai/mty.c
Parent Directory
| Revision Log
| Patch
| 35 |
#include "config.h" |
#include "config.h" |
| 36 |
#include "cp932.h" |
#include "cp932.h" |
| 37 |
#include "crypt64.h" |
#include "crypt64.h" |
| 38 |
|
#include "desconst.h" |
| 39 |
#include "expr.h" |
#include "expr.h" |
| 40 |
#include "translate.h" |
#include "translate.h" |
| 41 |
|
|
| 47 |
#define N_ALU (sizeof(WS_T) / sizeof(ALU_T)) |
#define N_ALU (sizeof(WS_T) / sizeof(ALU_T)) |
| 48 |
#define ALU_BITS (CHAR_BIT * sizeof(ALU_T)) |
#define ALU_BITS (CHAR_BIT * sizeof(ALU_T)) |
| 49 |
|
|
|
/* 鍵転置 PC1 */ |
|
|
static int const tr_pc1[8][7] = |
|
|
{ |
|
|
{ 8, 16, 24, 56, 52, 44, 36}, |
|
|
{ 7, 15, 23, 55, 51, 43, 35}, |
|
|
{ 6, 14, 22, 54, 50, 42, 34}, |
|
|
{ 5, 13, 21, 53, 49, 41, 33}, |
|
|
{ 4, 12, 20, 28, 48, 40, 32}, |
|
|
{ 3, 11, 19, 27, 47, 39, 31}, |
|
|
{ 2, 10, 18, 26, 46, 38, 30}, |
|
|
{ 1, 9, 17, 25, 45, 37, 29}, |
|
|
}; |
|
|
|
|
|
/* LR最終転置 */ |
|
|
static int const tr_fp[64 + 2] = |
|
|
{ |
|
|
39, 7, 47, 15, 55, 23, 63, 31, |
|
|
38, 6, 46, 14, 54, 22, 62, 30, |
|
|
37, 5, 45, 13, 53, 21, 61, 29, |
|
|
36, 4, 44, 12, 52, 20, 60, 28, |
|
|
35, 3, 43, 11, 51, 19, 59, 27, |
|
|
34, 2, 42, 10, 50, 18, 58, 26, |
|
|
33, 1, 41, 9, 49, 17, 57, 25, |
|
|
32, 0, 40, 8, 48, 16, 56, 24, |
|
|
64, 64, |
|
|
}; |
|
|
|
|
|
/* 鍵シフトスケジュール |
|
|
KEY::k[2] を贅沢に用いて取り出しの簡素化を図る */ |
|
|
static int ks_ls[] = |
|
|
{ |
|
|
1, 1, 2, -1, |
|
|
2, -1, 2, -1, |
|
|
2, -1, 2, -1, |
|
|
2, -1, 1, 2, |
|
|
-1, 2, -1, 2, |
|
|
-1, 2, -1, 2, |
|
|
-1, 2, -1, 1 - 28, |
|
|
}; |
|
|
|
|
| 50 |
/* 1ビット分 */ |
/* 1ビット分 */ |
| 51 |
typedef union SLICE |
typedef union SLICE |
| 52 |
{ |
{ |
| 79 |
unsigned char okey[8 + 8]; |
unsigned char okey[8 + 8]; |
| 80 |
|
|
| 81 |
/* 鍵クラス */ |
/* 鍵クラス */ |
| 82 |
|
static |
| 83 |
struct |
struct |
| 84 |
{ |
{ |
| 85 |
unsigned cls; |
unsigned cls; |
|
|
Legend:
| Removed from v.39 |
|
| changed lines |
| |
Added in v.41 |
|
|
| |