Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Losing Bits with Pack/Unpack

by kikuchiyo (Friar)
on Sep 17, 2020 at 10:43 UTC ( #11121871=note: print w/replies, xml ) Need Help??

in reply to Losing Bits with Pack/Unpack

Are you trying to maximize the amount of data you can stuff into a single tweet by abusing Twitter's arbitrarily defined character limit rules?

If yes, there are schemes for that: see e.g.

Replies are listed 'Best First'.
Re^2: Losing Bits with Pack/Unpack
by o0lit3 (Friar) on Sep 17, 2020 at 14:34 UTC
    Yeah, this is the idea. I see this javascript solution uses a lookup array and is using bitwise operations to construct an index to lookup in the array... Seems like this could be rewritten in perl with similar bitwise ops, but there is no "simple" solution using only pack and unpack based on the fact that those methods are byte aligned. Thanks for the help!
      I doubt there are any simple solutions with just pack and unpack. Most of the complexity of the base2048 implementation I've linked comes from paying attention to Twitter's rules about what it considers a "text" or "CJK" or "sendable" character. Perl's comprehensive Unicode support (character classes in regexes etc.) might be useful, if you were to rewrite the thing in it.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11121871]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2022-01-21 09:07 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (57 votes). Check out past polls.