Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
Working ...

Anjan Roy itzmeanjan

😎
Working ...
View GitHub Profile
@itzmeanjan
itzmeanjan / sphincs_kat_generation.patch
Created Nov 28, 2022
Git Patch for generating Known Answer Tests ( KATs ) from SPHINCS+ Reference Implementation
View sphincs_kat_generation.patch
diff --git a/ref/Makefile b/ref/Makefile
index a3aabad..24c34e1 100644
--- a/ref/Makefile
+++ b/ref/Makefile
@@ -43,7 +43,7 @@ benchmarks: $(BENCHMARK)
benchmark: $(BENCHMARK:=.exec)
PQCgenKAT_sign: PQCgenKAT_sign.c $(DET_SOURCES) $(DET_HEADERS)
- $(CC) $(CFLAGS) -o $@ $(DET_SOURCES) $< -lcrypto
+ $(CC) $(CFLAGS) -o $@ $(DET_SOURCES) -I/usr/local/opt/openssl@1.1/include -L/usr/local/opt/openssl@1.1/lib $< -lcrypto
@itzmeanjan
itzmeanjan / matrix_multiply.glsl
Last active Nov 20, 2022
😎 Parallel Matrix Multiplication on GPGPU, using Vulkan Compute API 🚴🏼
View matrix_multiply.glsl
#version 450
#pragma shader_stage(compute)
layout(local_size_x = 8, local_size_y = 4, local_size_z = 1) in;
layout(set = 0, binding = 0) buffer readonly MatrixA {
int[1<<20] matrix_a;
};
layout(set = 0, binding = 1) buffer readonly MatrixB {
@itzmeanjan
itzmeanjan / dilithium_kat_generation.patch
Last active Nov 5, 2022
Git Patch to Generate Known Answer Tests ( KATs ) from Dilithium Reference Implementation
View dilithium_kat_generation.patch
diff --git a/ref/hex_print.h b/ref/hex_print.h
new file mode 100644
index 0000000..7afd872
--- /dev/null
+++ b/ref/hex_print.h
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdint.h>
+
+inline void to_hex(const uint8_t *const bytes, const size_t blen) {
@itzmeanjan
itzmeanjan / kyber_kat_generation.patch
Last active Nov 5, 2022
Git Patch to Generate Known Answer Tests ( KATs ) from Kyber Reference Implementation
View kyber_kat_generation.patch
diff --git a/ref/hex_print.h b/ref/hex_print.h
new file mode 100644
index 0000000..7afd872
--- /dev/null
+++ b/ref/hex_print.h
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdint.h>
+
+inline void to_hex(const uint8_t *const bytes, const size_t blen) {
@itzmeanjan
itzmeanjan / test_montgomery_arithmetic.py
Last active Aug 5, 2022
Montgomery Modular Arithmetic for 256 -bit `secp256k1` Prime Field
View test_montgomery_arithmetic.py
#!/usr/bin/python3
from math import ceil
from typing import List, Tuple
from random import randint
def bit_count(num: int) -> int:
'''
Same as len(bin(num)[2:])
@itzmeanjan
itzmeanjan / recovery.rs
Last active Feb 25, 2022
Reed Solomon Erasure Coded Data Recovery with (I)FFT
View recovery.rs
use dusk_plonk::fft::EvaluationDomain;
use dusk_plonk::prelude::BlsScalar;
mod utils {
use dusk_plonk::fft::EvaluationDomain;
use dusk_plonk::prelude::BlsScalar;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use std::time::{SystemTime, UNIX_EPOCH};
@itzmeanjan
itzmeanjan / dft.cpp
Last active Nov 17, 2021
⭐️ Parallel DFT on GPGPU, using SYCL DPC++ 🔥
View dft.cpp
#include <CL/sycl.hpp>
#include <chrono>
#include <complex>
#include <iostream>
using namespace sycl;
typedef std::complex<double> cmplx;
constexpr uint N = 1 << 10;
constexpr uint B = 1 << 5;
@itzmeanjan
itzmeanjan / cholesky_factorization.cpp
Created Oct 18, 2021
👽 Parallel Cholesky Factorization targeting Accelerators, using SYCL DPC++ 🔥
View cholesky_factorization.cpp
#include <CL/sycl.hpp>
#include <chrono>
#include <iostream>
#include <random>
using namespace sycl;
const uint N = 1 << 10;
const uint B = 1 << 5;
const float MULT_FACTOR = .5f;
@itzmeanjan
itzmeanjan / determinant.py
Last active Oct 21, 2021
Computing Determinant of Square Matrix using Condensation Method
View determinant.py
#!/usr/bin/python3
import numpy as np
from copy import deepcopy
from functools import reduce
from time import time
N = 1 << 8
'''
@itzmeanjan
itzmeanjan / improved_lu_decomposition.cpp
Last active Oct 15, 2021
🏃‍♂️ Fast, Parallel LU Factorization, using SYCL DPC++ 🏅
View improved_lu_decomposition.cpp
#include <CL/sycl.hpp>
#include <chrono>
#include <iostream>
#include <random>
using namespace sycl;
constexpr uint N = 1 << 10;
constexpr uint B = 1 << 6;