Wednesday, October 24, 2012

pimp your dive

For all your pimping-of-your-dive-gear needs, visit DiveTag. Custom mask covers, stickers, and much more to come.

Wednesday, June 13, 2012

Large integer arithmetic and public key cryptography in Objective-C

I finished act-I of my little quest to learn Objective-C. I implemented FGInt, a library for large integer arithmetic and with it I implemented some public key cryptography algorithms: RSA, ElGamal, DSA and GOSTDSA. You can download them here.
It was not as straightforward as I wanted it to be because Objective-C turned out to be a lot slower than I expected. Lots of optimizations needed, and I am still not satisfied with the speed of addition. All the other operations perform reasonably. I compared it to my previous work, FGInt for FreePascal, and managed to reduce the difference in speed to below a factor of 1.5.
Update (27/6/2012): Elliptic Curve Arithmetic, ECDSA and ECElGamal added.
Update (20/5/2014): Moved to GitHub.
 

Monday, May 7, 2012

Reducing Skype's CPU usage on a macbook pro

Ever since I got my first mac in 2007, pretty as it may be, it did not play nice with flash or skype, and now in 2012, it still doesn't. I read articles about how flash was finally hardware accelerated, sadly not for my 2007 macbook pro, nor for my early 2011 mbp. Rather than scolding Adobe and Skype for neglecting that, I am happy to share a solution, found here.
My mbp gets hot with skype video calls, too hot, as it makes the fans blow continuously at full speed. Facetime doesn't, but then again, skype's sound is a whole lot better and its video can be. At first I found that turning off my own video does make the cpu usage manageable, but what fun is a video call when the other party cannot see you? So the bulk of the cpu usage is in encoding the video, which skype does not seem to offload on the GPU.
The link has 2 solutions, namely
- turn on your firewall and disable incoming connections for skype.
- secondly, configure ipfw such that the outgoing bandwidth is limited to 70KB/s, which tells skype not to encode and transmit HD video to the other party.

Both these tricks reduced the CPU usage of skype down to a 60%-ish level, and made my fans a lot happier, they still hum at a slightly higher speed, but way below half of the full speed. This does mean no HD video for your partner, but HQ video, if your bandwidth permits it. See this link for skype's video bandwidth requirements.

Note that the fix didn't work at first, until I changed the port in Settings -> Advanced -> Incoming connection port: to 5665, or the port in the command "ipfw add 55555 pipe 55555 src-port 5665" to the one mentioned in the settings.

Enjoy an enjoyable skype video call.

Update (8/5/2012):
It turns out, that the above only restricts outgoing traffic, but if your (lady)friend has a sweet fiber connection and broadcasts in HD, then nothing really changed. But you can use the same principle to throttle the incoming bandwidth:
- first, add the rule "pipe 55557 ip from any to any dst-port 5665 in", I used waterroof for this,
- secondly, like before, I restricted the bandwidth on that pipe with the terminal command  "sudo ipfw pipe 55557 config bw 70KByte/s".

That more or less did the trick. It is probably possible to create one duplex pipe for all skype traffic and restrict bandwidth for that pipe, but I'll look into that when I want to bother. If you know, let me know in the comments. It's a better idea not to, this way you can decide the limits on up- and download yourself instead of letting the firewall decide how to divide the bandwidth between upload and download.

Update (10/5/2012):
It turns out that after every reboot my rules disappeared, so I placed them in a batch file for your convenience, download here. The file names pretty much tell you what they do.