资源简介
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个文件信息
相关资源
- 希尔密码加密、解密和破密
- PNG加密解密工具73383
- umeshmotion网格推移
- m1卡 ic卡可选择扇区初始化加密软件
- 三星DDR800内存条PCB文件和原理图
- Zprotect专业版(无限制) 一机一码E
- 加密软件漏洞评测系统 V8.9
- C 大整数RSA加密
- [免费]安全加密软件U盘加密,文件加
- 国内一家大型软件公司内部的正规软
- 加密cad图形的lisp文件
- 先进先出库存管理excel表格.rar
- ply格式文件的读写程序
- 透明加密源码及说明
- Openssl给文件传输加密
- K码和经纬度转换excel表格
- 美赛论文MCM两个word模板 论文格式 w
- 武汉大学本科生论文格式自动排版工
- 莱卡 全站仪数据格式转换程序,有源
- 3des加解密_C 实现
- ESAM相关文章集合
- 项目周报格式(excel格式报表)
- 一个读取地震数据seg2或dat格式的程序
- 广东工业大学汇编实验二用表格形式
- RSA AES DES ECC加密算法源码
- 密码学课程设计:DES加密解密算法的
- C 标准文档(已加密)
- 计算方法上机程序——拉格朗日插值
- 软件工程文档模板1可行性研究报告
- 数值分析 计算方法 牛顿插值 拉格朗
评论
共有 条评论