I'm reading a paper called More Efficient Oblivious Transfer Extensions with Security for Malicious Adversaries by Gilad Asharov, Yehuda Lindell, Thomas Schneider and Michael Zohner.
On page 8 they present their protocol. When presenting the tools being used, they write:
If my understanding is correct they use a pseudorandom generator called G which takes as an input an object consisting of zeros and ones of length k and produce an object of zeros and ones of length m.
My questions is: How can I implement this in Python?
How can I implement a pseudorandom generator which takes a seed of size k and produces an output of size m?
you can use itertools and random.choice() this one will produce out of '01' with length 40 permutations of size 39, and islice will get you first 10 out of 1000.
You could just always generate a string of
m
ones :-) ...Kidding apart a simple solution is to feed the input number (that will be between
0
and2**k-1
) torandom.seed
and then get the result fromrandom.randrange(1<<m)
.