Thanks for your proposal, this could be a useful library. I have some suggestions :

1. Use a class
2. Provide two other versions, one without any extension, one with the BC math extension which is more popular than gmp
3. Detect which extension is installed (or not) and use the best version of the encode/decode functions
4. Provide unit tests
5. Provide benchmarks for each version of the encode/decode function
6. Add documentation
7. Get rid of references to Flickr

Have a look at these for other versions :
https://gist.github.com/126883 (no extension)
https://gist.github.com/865912 (tests in python)
http://pastebin.com/vmRQC7ha (bcmath version)
http://code.gogulski.com/bitcoin-php/bitcoin_8inc_source.html (other bcmath version)