Groups
Sign in
Groups
skynet-users
Conversations
About
Send feedback
Help
lua des crypt padding兼容问题
152 views
Skip to first unread message
rei
unread,
Sep 25, 2015, 11:45:25 PM
9/25/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skynet-users
lua des crypt 算法和java 的DES/ECB/PKCS5Padding模式不兼容,padding的填充模式需要调整下:
int bytes = textsz - i;
uint8_t tail[8];
int j;
for (j=0;j<8;j++) {
if (j < bytes) {
tail[j] = text[i+j];
} else if (j==bytes) {
tail[j] = 0x08 - bytes;
} else {
tail[j] = 0x08 - bytes;
}
}
des_crypt(SK, tail, buffer+i);
缺几位填充几,在此记录下。
盐巴
unread,
Jan 4, 2018, 12:25:20 AM
1/4/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skynet-users
des decode 的时候呢?
在 2015年9月26日星期六 UTC+8上午11:45:25,rei写道:
盐巴
unread,
Jan 4, 2018, 1:45:47 AM
1/4/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to skynet-users
int
padding = buffer[textsz-1];
在 2015年9月26日星期六 UTC+8上午11:45:25,rei写道:
Reply all
Reply to author
Forward
0 new messages