Monday, November 16, 2009

Message Digest algorithms in Java Cryptography Architecture

This is the 2nd part of Message Digest algorithms test. I did performance tests on MD5, SHA-1, SHA-256, SHA-384 and SHA-512 in Java Cryptography Architecture (JCA) of Java SE6 against the same file as in 1st part.

Alg. Name Real Time User Time System Time
MD5 0m15.004s 0m9.109s 0m1.344s
SHA-1 0m38.654s 0m35.318s 0m2.036s
SHA-256 0m59.053s 0m56.032s 0m1.784s
SHA-384 1m56.362s 1m53.663s 0m1.364s
SHA-512 1m58.385s 1m53.727s 0m1.484s

The results are quite interesting if compared with the results of md5sum, sha1sum, sha224sum, sha256sum, sha384sum and sha512sum in Ubuntu in 1st part. Basically
  • MD5 is comparable in terms of time but with a higher percentage of CPU usage (2X);
  • SHA-1 and SHA-256 are much slower (2X);
  • SHA-384 and SHA-512 are a bit faster than native implementations.

Tuesday, November 10, 2009

VoIP bandwidth usage

I think in most countries, it's not a problem to worry about the bandwidth usage of VoIP. But it's obviously not the case here in Australia, most Internet users have download limit or even upload limit. That's why "how much bandwidth is used" becomes an FAQ. There are many bandwidth calculators out there, but here is the statistics from my ATA.

Using G729a codec, the throughput is about 3.6MB/hr in one direction.

Using G711u codec, the throughput is about 28.8MB/hr in one direction.

In my calculation, 1MB = 1,000,000Bytes, which is correct to hard disk manufacturers, Snow Leopard and my ISP.

Tuesday, November 03, 2009

Message Digest algorithms

I'm doing a home-made backup product that needs to compute checksum of tens of thousands of file. According to Wikipedia, there are quite a number of checksum algorithms.

This product will first base on Linux and some of the checksum utilities are already provided by Ubuntu 9.10. They are md5sum, sha1sum, sha224sum, sha256sum, sha384sum and sha512sum.

In case one day I will port this product to Windows, I also checked MessageDigest of Java Cryptography Architecture (JCA) in Java SE6. It supports MD2, MD5, SHA-1, SHA-256, SHA-384 and SHA-512.

Doing checksum is both CPU and IO intensive. I did a simple performance test today on how much CPU time is needed to compute different checksums (commonly supported by Linux and MessageDigest) of a 723,488,768-byte file.

Alg. Name Real Time User Time System Time
md5sum 0m14.655s 0m4.380s 0m1.300s
sha1sum 0m15.187s 0m12.641s 0m1.764s
sha256sum 0m25.859s 0m23.341s 0m1.656s
sha384sum 2m25.417s 2m23.841s 0m1.432s
sha512sum 2m25.733s 2m23.373s 0m2.116s

Now I have a clear idea of work load of these algorithms. I will do a Java implementation test later to see if I can get similar results.