Hacking around with Twitter …

Image representing Twitter as depicted in Crun...

Image via CrunchBase

Twitter is an interesting beast … I’m still not too sure if I really see that there is any real benefit from it – I do find it fun though 🙂 Anyhoo, it occurred to me as I was driving home tonight, stuck in the pouring rain, in Oxford traffic, that Twitter, like all of these social networking sites, is a great way to send coded messages. ( Watch my hit count rise drastically as the NSA and GCHQ hammer me 😉 ) There are enough tweets, and they are random enough to drown out pretty much any useful data, but even so, I’d be reluctant as a spy or other to use twitter either in code or directly to communicate with my handlers / followers … It’s a bit too obvious – this led me to think of encryption, and rather conveniently, Twitter itself sets the key size ! Allowing for a few control characters to identify the different types of message, I think that it is possible to implement a neat little public key exchange / encryption setup using Twitter & using Perl, a few CPAN libraries, and this blog, I’m going to set out to do it as a proof of concept over the next few days …

Phase 1 : Completed before I started typing this up – get myself a few extra twitter accounts to play with TweetDeck graciously supports multiple accounts so I can monitor the Perl back processes, so I now have twcrypt, twcrypt_a and twcrypt_b to play with …

Phase 2: Raid CPAN for someone else’s hard work 🙂 Net::Twitter::Lite by Marc Mims and Crypt::OpenSSL::RSA by Ian Robertson ( after several false starts with other RSA implementations and much fun with Math::Pari. ). So that I stand some chance of getting _some_ sleep before morning ! ( If you are on MacOS X, as I am, running cpan sudo aids in the installation somewhat …  )

Phase 2(a): Install Komodo Edit on new laptop, because I’ve not done it yet … Great Perl editor, and free !

Phase 3: Quick planning stage … 140 chars – 128 char for the key leaves … drum roll … 12 for signals soooo …

01 02 03 04 05 06 07 08 09 10 11 12t  w  c                          -  = type marker ( note the - at char 12 )
t  w  c  -  p  u  b  l  i  c     -  = public key distro indicator
t  w  c  -  m  s  g              -  = message indicator ( thinking about allowing multipart messages later )

That’s about it for now, either I’m too tired, too stupid or there just plain aren’t any more required at this time ( could abbreviate I guess and have a stronger key ? ) At the moment, I think that the two communicating parties are going to have to be followers, with only 12 chars to spare there’s not enough room to use @names …

Quick Aside : This isn’t a 128 bit key, this is a 128 byte key or 8 times that e.g. 1024 bit – this is considered pretty much the minimum standard in the world of encryption with 2048 and larger keys being in common, difficult to break, use. You should bear in mind though that a 1024 bit key still supplies a fair standard of encryption. Having said all of this, OpenSSL is being a bugger for actually generating a key that _is_ 128 bytes long, if I generate a 1024bit key, I seem to end up with a 217 byte public section when all is said and done … More investigation tomorrow !
With thanks to ...

With thanks to xkcd

Phase 4: Start writing program … in the morning 🙂

Tagged , , , , , ,

One thought on “Hacking around with Twitter …

  1. tshirtfrank says:


    Cool post, I had no Idea you could do that stuff with Twitter.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: