# Divide data into parts and restore from them

I'm not much familiar with cryptography, so please guide me in the right direction on the following question:

Let's say I have some data (array of bytes) $D$. I want to convert it into $N$ pieces (arrays of bytes) in such a way that

• if someone knows at least $m$ of those pieces ($m \le N$) then it should possible to restore the original data, i.e. $D = f(p_1,...p_m)$. It's important that any $m$ pieces should suffice to restore $D$, not necessarily $m$ consecutive pieces

• if someone knows $k \lt m$ pieces then there's no way (computationally difficult) to restore $D$ or any part of $D$

Example: if $N=3$ and $m=2$, it should be possible to restore $D$ from $(p_1, p_2)$ or $(p_2,p_3)$ or $(p_1,p_3)$ but not from $p_1$ or $p_2$ or $p_3$ alone.

The problem you are describing is called Secret Sharing And the common algorithm to solve the m of N is https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing

It is not only computationally difficult, it is information theoretic impossible to discover the secret without the required number of shares.