Basic BWT en/de-coding implementation