Archive for the ‘dev’ Category

RIPEMD with Bouncy Castle Cryptography Library

Wednesday, June 24th, 2009

If someone asks you to make simple tool that creates a RIPEMD-160 message digest and output it in Base64 encoding what will you do?

This is how I started:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.util.encoders.Base64;
/**
 * Calculates RIPEMD-160 for an input message and output it in Base64 encoding
 * @author robert sicoie
 *
 */
public class RipeMD {
 
	private static void usage() {
		System.err.println(
"RipeMD <message>\n" +
"Calculates RIPEMD-160 for a given message and outputs it in Base64 encoding");
	}
 
	/**
	 * @param args message The message we want to calculate RIMEMD-160 for.
	 */
	public static void main(String[] args) {
		if (args.length < 1) {
			usage();
			System.exit(1);
		}
		String inputMessage = args[0];
		// Get the message digest generator
		JDKMessageDigest ripeDigest = new JDKMessageDigest.RIPEMD160();
		byte [] input = inputMessage.getBytes();
		byte [] output = ripeDigest.digest(input);
		String outputMessage = new String(Base64.encode(output));
		System.out.print(outputMessage);
	}
}

Bouncy Castle library makes it really easy!

Rails on Dreamhost

Saturday, June 21st, 2008

These days, while testing my personal Ruby on Rails project I’m currently working on, I realized how slow Dreamhost’s FCGI Rails support is.  So after intensive search for answers I had to contact Dreamhost support team. I wrote them about the problem and today they replayed to my email:

 I apologize for the slowness with our FCGI and rails. This is actually one of the reasons we worked with the Phusion to get passenge (mod_rails) working on our servers, passenger is faster, better and stronger than FCGI rails implementation.
I would highly recommend you try your application with passenger (mod_rails) instead of fastCGI, this should substantially increase the speed of your site.

And they were right.

To enable passanger, just access dreamhost panel and check “Ruby on Rails Passenger (mod_rails)?”. This way your Ruby on Rails app. should get more speed.

new Photos page

Tuesday, February 19th, 2008

I just have changed the “Photos” page. It load albums from google’s picasaweb through atom feeds. This page allows photo navigation, so I would call it a photo gallery. I plan to put the code behind into a wordpress plugin, so it’s not ready. Please report any issue…It helps me a lot.

Android [ part 1 ]

Saturday, November 24th, 2007

Google has recently released Android – the new open source operating system and software platform. This has been developed by Google and others as part of the Open Handset Alliance, which has over 30 partners supporting it. The goal of this ambitious initiative is to spur innovation in the mobile space and accelerate improvements in how people use the Web via cell phones.

But there is no mobile device on the market able to support this technology. The first Android-based phones should hit the market in the second half of 2008. The platform will be made available under Apache 2 license giving a lot of flexibility to those who adopt it to modify its components and design services and products.

To motivate developers to adopt Android platform, Google has launched the Android Developer Challenge, which will provide $10 million in awards for great mobile applications built on this platform. As submissions start on January 2, 2008 and last until on March 3, 2008 (for the first challenge) I thing I’ll start learning something more about this platform and maybe participate. There seams to be nothing to loose…