Build a better website in less than an hour with GoDaddy
Ad Get started today for FREE! no tech skills required. Get found on Google and top sites like Facebook

Rearray binary tool

This high performance tool rearrays its input adding a second dimension of size n bits/8 bits.

It is useful to test serial correlation by estimating the entropy of each output.

#rearray each 8/32 bits in 4 files
output[0][0] = input[0] >> rearray.0
output[1][0] = input[1] >> rearray.1
output[2][0] = input[2] >> rearray.2
output[3][0] = input[3] >> rearray.3
output[0][1] = input[4] >> rearray.0
output[1][1] = input[5] >> rearray.1
output[2][1] = input[6] >> rearray.2
output[3][1] = input[7] >> rearray.3


#rearray each 8/16 bits in 2 files
rearray-16 input

#rearray each 8/32 bits in 4 files
rearray-32 input

#rearray each 8/64 bits in 8 files
rearray-64 input

#rearray each 8/128 bits in 16 files
rearray-128 input

#rearray each 8/256 bits in 32 files
rearray-256 input

#rearray each 8/512 bits in 64 files
rearray-512 input

Recommended use
for b in {16,32,64,128,256,512}
 do rearray-$b input
 for f in rearray.*
  do entropy 1 $f
rm rearray.*

apt-get install rearray
#makefile as su
make install


g++ -O3 -std=c++11 rearray.cpp -o rearray-16 -D Bits=16
g++ -O3 -std=c++11 rearray.cpp -o rearray-32 -D Bits=32
g++ -O3 -std=c++11 rearray.cpp -o rearray-64 -D Bits=64
g++ -O3 -std=c++11 rearray.cpp -o rearray-128 -D Bits=128
g++ -O3 -std=c++11 rearray.cpp -o rearray-256 -D Bits=256
g++ -O3 -std=c++11 rearray.cpp -o rearray-512 -D Bits=512