`length` is used to remove padding introduced by `EncodeRing()`. It might make things more clear to rename it to `padding` and then do `Data[:len(Data)-padding]` instead of `Data[:length]`.