remind me when I should publish the solution :)
@me The dd output is limited by count=1111 and may therefore contain less than $bytes characters among those specified by $chars. In which case the sed output will be empty. Anything else?
Great! You're right. That's the obvious pitfall which is cloaking the one I'm asking for (and I stumbled over).
A #riddle. There are two pitfalls in this code. One cloaking the other. Can you see them?