资源简介
ntru 加密算法开源C实现;ntru加密系统 是一种基于格的公钥密码体制,可以抵抗量子攻击,而且比RSA等传统的公钥密码体制的效率高,上传的代码用c实现了该密码体制。
代码片段和文件信息
#ifndef __KERNEL__
# define __KERNEL__
#endif
#ifndef MODULE
# define MODULE
#endif
#include
#include
#include
#include “ntru_crypto.h“
/* entropy function
*
* THIS IS AN EXAMPLE FOR WORKING SAMPLE CODE ONLY.
* IT DOES NOT SUPPLY REAL ENTROPY BECAUSE THE RANDOM SEED IS FIXED.
*
* IT SHOULD BE CHANGED SO THAT EACH COMMAND THAT REQUESTS A BYTE
* OF ENTROPY RECEIVES A RANDOM BYTE.
*
* Returns 1 for success 0 for failure.
*/
static uint8_t
get_entropy(
ENTROPY_CMD cmd
uint8_t *out)
{
/* 21 bytes of entropy are needed to instantiate a DRBG with a
* security strength of 112 bits.
*/
static uint8_t seed[] = {
‘U‘‘s‘‘e‘‘ ‘‘a‘‘ ‘‘d‘‘i‘‘f‘‘f‘‘e‘‘r‘‘e‘‘n‘‘t‘‘ ‘
‘s‘‘e‘‘e‘‘d‘‘!‘
};
static size_t index;
if (cmd == INIT) {
/* Any initialization for a real entropy source goes here. */
index = 0;
return 1;
}
if (out == NULL)
return 0;
if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) {
/* Here we return the number of bytes needed from the entropy
* source to obtain 8 bits of entropy. Maximum is 8.
*/
*out = 1; /* this is a perfectly random source */
return 1;
}
if (cmd == GET_BYTE_OF_ENTROPY) {
if (index == sizeof(seed))
return 0; /* used up all our entropy */
*out = seed[index++]; /* deliver an entropy byte */
return 1;
}
return 0;
}
/* Personalization string to be used for DRBG instantiation.
* This is optional.
*/
static uint8_t const pers_str[] = {
‘S‘ ‘S‘ ‘L‘ ‘ ‘ ‘a‘ ‘p‘ ‘p‘ ‘l‘ ‘i‘ ‘c‘ ‘a‘ ‘t‘ ‘i‘ ‘o‘ ‘n‘
};
/* AES-128 key to be encrypted. */
static uint8_t const aes_key[] = {
0xf3 0xe9 0x87 0xbb 0x18 0x08 0x3c 0xaa
0x7b 0x12 0x49 0x88 0xaf 0xb3 0x22 0xd8
};
static void __exit ntru_exit_module(void)
{
printk(KERN_DEBUG “Shutting down NTRUEncrypt Sample\n“);
}
/*
*
* This sample code will:
* 1) generate a public-key pair for the EES401EP2 parameter set
* 2) DER-encode the public key for storage in a certificate
* 3) DER-decode the public key from a certificate for use
* 4) encrypt a 128-bit AES key
* 5) decrypt the 128-bit AES key
*/
static int __init ntru_init_module(void)
{
uint8_t public_key[557]; /* sized for EES401EP2 */
uint16_t public_key_len; /* no. of octets in public key */
uint8_t private_key[607]; /* sized for EES401EP2 */
uint16_t private_key_len; /* no. of octets in private key */
uint8_t encoded_public_key[591]; /* sized for EES401EP2 */
uint16_t encoded_public_key_len; /* no. of octets in encoded public key */
uint8_t ciphertext[552]; /* sized fof EES401EP2 */
uint16_t ciphertext_len; /* no. of octets in ciphertext */
uint8_t plaintext[16]; /
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\
文件 64 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\AUTHORS
文件 7049 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\CC0-Legal
文件 365 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\ChangeLog
文件 1104 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\INSTALL
文件 1792 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\LICENSE
文件 4447 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\Makefile.am
文件 606 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\PATENTS
文件 8811 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\README
文件 33 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\autogen.sh
文件 1876 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\configure.ac
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\doc\
文件 692900 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\doc\UserNotes-NTRUEncrypt.pdf
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\driver_test\
文件 1300 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\driver_test\Makefile.old
文件 12534 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\driver_test\__ntruEncrypt.c
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\include\
文件 15278 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\include\ntru_crypto.h
文件 7175 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\include\ntru_crypto_drbg.h
文件 1661 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\include\ntru_crypto_error.h
文件 2578 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\include\ntru_crypto_platform.h
文件 374 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\libntruencrypt.sym
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\sample\
文件 16458 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\sample\sample_NTRUEncrypt.c
目录 0 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\
文件 25585 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_drbg.c
文件 9911 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_hash.c
文件 7191 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_hash.h
文件 2177 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_hash_basics.h
文件 9143 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_hmac.c
文件 5750 2017-03-28 17:30 NTRUEncrypt-76b5bd112368ed39fb1fe10896a8d21189d75231\src\ntru_crypto_hmac.h
............此处省略43个文件信息
相关资源
- 怎么用格柏和ET共一台打印机输出的方
- TIFF图像处理代码,支持GROUP4格式,和
- 字符串比较问题对于长度相同的2 个字
- 读取Excel表格里的内容并显示在Swing界
- 在页面中导入excel文件并以表格显示
- 活字格注册机V4.02.rar
- RSA生成密钥对、公钥加密和私钥解密
- qt可以使用的AES加密的类
- NI_数据交换规格书 NIMIF1.3.1便携类(代
- 内存卡低格工具汉化版
- 全国所有大学数据包含经纬度(json格
- U盘仿真软驱格式化v2.0
- web页面嵌入excel控件,网页中在线编辑
- AES加密算法modelsim仿真-Verilog语言
- PGP 10.X 汉化包
- SAE 1939 汽车通讯报文
- STC系列单片机原理原理图库Altium Des
- bat脚本实现按txt文件的每行内容批量
- 三维模型文件中的OBJ格式在OpenGL中的
- DWG格式电气元件图库
- powerword 新英格兰39节点系统
- 追赶法计算断面水位流量,圣维南方
- 三角形网格剖分程序,可以把任意平
- Misty 加密算法实现
- pbfunc外部函数扩展
- 数字证书制作签名加密工具包
- labview wav格式播放器
- 超大棋盘格原尺寸标定板 相机内参标
- Arduino 格力空调红外编码库,当时做的
- DM642的Protel格式原理图库
评论
共有 条评论