Your immediate response will be greatly appreciated
Thanks to avoid such comment if you answer 24hrs after a reply posted within 30min after your question...
What algo do you need? The installation of extensions or the creation of such an extension? Source code should be available somewhere on the Apache Software Foundation site but you'll get the whole code I guess.
Creation of extensions is documented in the extension site. There is also an extension to build extensions (Basic Addon Builder IIRC).
AOO 4.1.2 on Xubuntu 15.10 (Wily Werewolf) and PortableApps port 4.1.2 on Windows 7