📄 romdes.c
字号:
/* ============================================================================ Project Name : jayaCard Module Name : proto/hal/crypto/romdes.c Version : $Id: romdes.c,v 1.4 2003/10/31 23:12:52 dgil Exp $ Description: ROM DES Tables The Original Code is jayaCard code. The Initial Developer of the Original Code is Gilles Dumortier. Portions created by the Initial Developer are Copyright (C) 2000-2003 the Initial Developer. All Rights Reserved. Contributor(s): This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see http://www.gnu.org/licenses/gpl.html History Rev Description 020903 dgil Wrote it from scratch 042504 dgil Read the fucking book ... and update the table given the choosen algorithm implementation :-( ============================================================================*/#include "precomp.h"#ifdef JAYACFG_DES_KER/* ========================================================================= initial permutation IP ========================================================================= */jbyte code ip[] = { 57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3, 61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7, 56, 48, 40, 32, 24, 16, 8, 0, 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6};/* ========================================================================= final permutation IP^-1 ========================================================================= */jbyte code fp[] = { 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};/* ========================================================================= permuted choice table (key) ========================================================================= */jbyte code pc1[] = { 56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3};jbyte code pc2[] = { 13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 44, 55, 34, 40, 50, 58, 33, 43, 54, 48, 36, 51, 47, 52, 42, 59, 37, 56, 49, 45, 53, 39, 32, 35};/* ========================================================================= expansion operation matrix ========================================================================= */jbyte code ei[] = { 31, 0, 1, 2, 3, 4, 3, 4, 5, 6, 7, 8, 7, 8, 9, 10, 11, 12, 11, 12, 13, 14, 15, 16, 15, 16, 17, 18, 19, 20, 19, 20, 21, 22, 23, 24, 23, 24, 25, 26, 27, 28, 27, 28, 29, 30, 31, 0};/* ========================================================================= The (in)famous S-boxes ========================================================================= */jdword code sbox[] = { 0xD8D8DBBCL, 0xD73559C1L, 0x8306F441L, 0x3DABEAFEL, 0x1CEC9542L, 0x8A408EFBL, 0xF079253FL, 0xCF34D510L, 0x721726B5L, 0x4CFEF21CL, 0x4DEADAA6L, 0xF2471AC9L, 0xEDA34BCFL, 0x338FA826L, 0x16D508D1L, 0xE048253FL, 0x8F0A4602L, 0x28BC163DL, 0x7CD56B19L, 0x8240BF20L, 0x6223ABC1L, 0x37D7E0A8L, 0xAF9FD4BCL, 0x59BB1BCFL, 0xB77C897EL, 0xE0810592L, 0x00A1344BL, 0x3F7AE567L, 0x091474BCL, 0x4D697B47L, 0xF36ABB62L, 0x949644D0L, 0x1647A960L, 0xA5DAC69AL, 0x587B189EL, 0x83E8BD45L, 0xF2A1E679L, 0x4FBF0121L, 0x67986989L, 0x30465AA9L, 0x49B899C3L, 0x7241E064L, 0xBF458774L, 0xCD9E619AL, 0xBE5E56BCL, 0x982035DBL, 0x81B27643L, 0x7F358E66L, 0xA5E4F7DFL, 0xDA2FE8E3L, 0xA79A8421L, 0x7FB513BEL, 0x89DE041EL, 0xC8017B16L, 0x78659B73L, 0xA7F8A65DL, 0x8C0F7AA2L, 0x05B21FCDL, 0x72D26B8CL, 0x84455C30L, 0x5221A967L, 0x724E8634L, 0x4D2D549CL, 0x38DBF9CBL};#endif/* JAYACFG_DES_KER *//* ========================================================================= That's all folks ! ========================================================================= */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -