This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
qc_mdpc_keyenc.c | |
Reference / educational implementation for QC-MDPC-like keygen + encode (binary) | |
- ring: F2[x] / (x^R + 1), with x^R == 1 (char 2) | |
- secret: h0, h1 (sparse polynomials) | |
- public: h = h0^{-1} * h1 mod (x^R+1) | |
- encode: given message m (bitpoly of degree < R), random sparse r0,r1,e: | |
u = r0 + r1 * h | |
v = m ^ (r1 * pub) ^ e | |
Note: This is for research/experimentation only. NOT production-ready. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC = gcc | |
CFLAGS = -O3 -Wall -Wextra -std=c11 -mavx2 -mpopcnt -Wextra | |
LDFLAGS = | |
SRC = demo_hqc_golay.c golay_crypto.c | |
OBJ = $(SRC:.c=.o) | |
TARGET = demo_hqc_golay | |
all: $(TARGET) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <immintrin.h> /* AVX2 intrinsics */ | |
#include <sys/types.h> | |
// 定数定義 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <assert.h> | |
// 定数定義 | |
#define N 257 | |
#define K 120 | |
#define DEG 520 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <assert.h> | |
// 定数定義 | |
#define N 257 | |
#define K 120 | |
#define DEG 520 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <assert.h> | |
#define N 257 | |
#define K 120 | |
#define DEG 520 |