A look at our MATLAB model…
function S = generatePrivateKey(m)
global q;
S = randi(q, [m, 1]);
end
function [A, B] = generatePublicKey(S, m, n)
global q;
A = randi(q, [n, m]);
e = round(randn(n, 1));
B = mod(A*S, q) + e;
end
function [u, v] = encryptBit(M, A, B)
global q;
sampleSize = fix(numel(B) / 4);
samplesChoices = randsample(1:length(B), sampleSize);
u = mod(sum(A(samplesChoices,:)), q);
v = mod(sum(B(samplesChoices,:)) - M * fix(q/2), q);
end
function M = decryptBit(u, v, S)
global q;
D = mod(v - dot(S, u), q)
M = D > q/4 & D < 3*q/4;
end
Source: lwe.m
Elapsed time is 38.385325 seconds.
Statistics (10000 tests) 82.95%
Not bad…!
m
is sort of useless…n
has a negative effectIncreasing n
also slows down the time it takes to encrypt and decrypt the messages…
Don’t make
n
large!
q
are goodm
- … whatevern
- Keep this small!q
- Make this large!Team Orange
Thank You! 🍊