Generate only the minimum required amount of bytes

Not important. Feel free to close request.