Fix for 0-padding in recovery-data when using NumPy

Issue #7 resolved
Former user created an issue

If you recreate a archive with Protect+ Data with enables NumPy, rescene fills each recovery byte to a 64bit int, which causes a padding of 7 Null-Bytes.

A7 00 00 00  00 00 00 00  6B 00 00 00  00 00 00 00  67 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  6A 00 00 00  00 00 00 00  D8 00 00 00  00 00 00 00  87 00 00 00  00 00 00 00
00 00 00 00  F5 00 00 00  00 00 00 00  39 00 00 00  00 00 00 00  AB 00 00 00  00 00 00 00

has to be

A7 6B 67 00  6A D8 87 F5 39 AB

This can be fixed by writing a bytearray instead of the sector or cleaner by adding a bytearray to the rs array

rarfs.write(sector)
=>
rarfs.write(bytearray(sector))
rs[rs_slice] = bitwise_xor(rs[rs_slice], bytearray(sector))
=>
rs[rs_slice] = bytearray(bitwise_xor(rs[rs_slice], bytearray(sector)))

Comments (4)

  1. Former user Account Deleted

    ah nice that my fork and pull request were accepted successfully though the bitbucked webinterface said there were some unknown errors and this repo cannot be forked.

    I also thought applying the bytearray at the end is faster, but if you dont use NumPy, it applies the bytearray to a bytearray. But Python should recognise that and return the original bytearray, anyway he writes the corrent data in both cases.

    I'll test and benchmark both options tomorrow.

  2. Log in to comment