Skip to content

Instantly share code, notes, and snippets.

View fumumue's full-sized avatar
🤒
Out sick

nao-yang fumumue

🤒
Out sick
View GitHub Profile
/*
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.
@fumumue
fumumue / Makefile
Last active September 25, 2025 07:43
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)
@fumumue
fumumue / avx.c
Last active September 25, 2025 03:44
HQCのSIMDバージョン。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <immintrin.h> /* AVX2 intrinsics */
#include <sys/types.h>
// 定数定義
@fumumue
fumumue / golay_hqc_ref.c
Created September 24, 2025 14:17
最新。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <assert.h>
// 定数定義
#define N 257
#define K 120
#define DEG 520
@fumumue
fumumue / kairyou_hqc.c
Last active September 24, 2025 01:51
コパイロットに修正してもらいました。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <assert.h>
// 定数定義
#define N 257
#define K 120
#define DEG 520
@fumumue
fumumue / gist:def66f3b84d84c8f7d24e909e6376951
Last active August 28, 2025 06:09
Golay符号でHQCもどきを作りました。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#define N 257
#define K 120
#define DEG 520