projects
/
my-code
/
crypto.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d32e0f7
)
grr, bytes -> bits 1st part
author
hackbard
<hackbard>
Sun, 28 Sep 2003 20:52:33 +0000
(20:52 +0000)
committer
hackbard
<hackbard>
Sun, 28 Sep 2003 20:52:33 +0000
(20:52 +0000)
des.c
patch
|
blob
|
history
diff --git
a/des.c
b/des.c
index
a1cdbba
..
29cfa94
100644
(file)
--- a/
des.c
+++ b/
des.c
@@
-42,9
+42,10
@@
int rotate_left(u8 *obj,int len) {
key_perm(u8 *key) {
int i;
key_perm(u8 *key) {
int i;
- u8 *new[DES_SUBKEY_LEN];
+ u8 *new[DES_SUBKEY_LEN/8];
+ memset(new,0,DES_SUBKEY_LEN/8];
for(i=0;i<DES_SUBKEY_LEN;i++)
for(i=0;i<DES_SUBKEY_LEN;i++)
- new[i
]=key[key_perm_table[i]]
;
+ new[i
/8]|=(key[key_perm_table[i]/8]>>((8-key_perm_table[i]%8)%8)
;
memcpy(key,new,DES_SUBKEY_LEN);
return 1;
}
memcpy(key,new,DES_SUBKEY_LEN);
return 1;
}
@@
-58,13
+59,22
@@
int subkey_trans(u8 *key,int round) {
return 1;
}
return 1;
}
+int fuckup_data(u8 *key,int round,u8 *plain,u8 *crypted) {
+ u8 permc[DES_PERMC_LEN];
+ int i;
+ for(i=0;i<DES_PERMC_LEN;i++)
+ permc[i]=key[subkey_perm_table[i]];
+
+ return 1;
+}
+
int des_crypt(u8 *plain,u8 *crypted,u8 *key) {
int round;
key_perm(key);
for(round=0;round<DES_ROUND;round++) {
subkey_trans(key,round);
int des_crypt(u8 *plain,u8 *crypted,u8 *key) {
int round;
key_perm(key);
for(round=0;round<DES_ROUND;round++) {
subkey_trans(key,round);
- // fuckup_data(key,round);
+ // fuckup_data(key,round
,plain,crypted
);
}
return 1;
}
return 1;