linux c des encrypt and decrypt
来源:互联网 发布:centos apache php 编辑:程序博客网 时间:2024/06/10 07:12
des为块加密算法,数据长度必须为8的倍数,密钥长度为8:
#include <stdlib.h>#include <stdio.h>#include <string.h>#include <rpc/des_crypt.h>int main(int argc, char** argv){ char c = '\x8'; printf("%c\n",'\x8');//\转义符后面三位数表示8进制如\101为65,\x8则为十六进制,\95则为十制 char data[4096]= "abcdefghijklmnopqrstuVW000000000";//des 加密,数据一定要是8的倍数,不补齐,密后做取舍 //we must fix the data to a multiple of 8... char key[8] = "12345678"; char key2[8] = "12345678"; des_setparity(key); ecb_crypt(key,data,strlen(data),DES_ENCRYPT); printf("%s\n",data); des_setparity(key2); ecb_crypt(key,data,strlen(data),DES_DECRYPT); printf("%s\n",data); return 0;}
[xxx@localhost code]$ gcc -g -lcrypt destest.c [xxx@localhost code]$ ./a.out .Ck玫??9.PhQg?.?j}R.O9abcdefghijklmnopqrstuVW000000000[xxx@localhost code]$
0 0
- linux c des encrypt and decrypt
- des encrypt and decrypt arithmetic source code
- (C++) RSA Encrypt and Decrypt Strings
- Encrypt and Decrypt
- Simple PHP encrypt and decrypt
- rsa encrypt and decrypt arithmetic source code
- Use Rijndael to Encrypt and Decrypt
- Javascript encrypt and decrypt library CrytoJS
- AES Encrypt And Decrypt AES加密解密
- How To: Use DPAPI to Encrypt and Decrypt Data (C#/VB.NET)
- 3DES encrypt by java, decrypt by c++
- Linux C/C++ Openssl RSA Encrypt/Decrypt(加密/解密) 简单示例教程
- Java: 如何加密解密 How to encrypt and decrypt
- decrypt与encrypt
- encrypt/ decrypt files or strings?
- zip compress/uncompress encrypt/decrypt
- encrypt加密 decrypt解密 函数
- Use AES Encrypt And Decrypt With Custom Key( Expand AesCryptoServiceProvider Class)
- 探究计算机C语言编辑程序技巧
- Gdiplus的坑:通过DrawImage进行放大不是很靠谱
- Little Pony and Expected Maximum
- FFmpeg MP3解码器的研究与优化
- 数字心电管理系统的探讨与设计
- linux c des encrypt and decrypt
- 基于JAVA EE 平台的在线考试系统设计探究
- 嵌入式GUI系统EFL研究
- SNBI project materials
- 浅谈工作型PPT之提高篇
- Java RandomAccessFile用法
- 关于c++pow()函数
- Js_dom_01
- 【阅读】《网页设计创意书》第四章——设计元素