Is there any possible way in which tmp can be longer?
As far as I understood the code tmps length is sjcl.bitArray.bitLength(arr)/8 and outs length is sjcl.bitArray.bitLength(arr)/8+padding.
So shouldn't out be always longer here?