I suspect you are not getting the len quite right.
First, I'm assuming all these are strings, not cstrings. (You can't use cstrings for binary values, and encrypted strings are binary values.)
second, len(string) returns declared length of the string, not clipped length. (And you can't clip because the encrypted password might end in chr(32).
So you need to track, and store, the length of encrypted fields. OR have a fixed-length string with a fixed length (including trailing spaces).