Archive

Archive for February, 2010

Hashcode, Adler, CRC collisions in action!

February 17, 2010 2 comments

If you want to see String’s hashcode, CRC32 or Adler32 colliding (producing same results for different Strings) – run this Groovy script:

import java.util.zip.Adler32
import java.util.zip.CRC32
import java.util.zip.Checksum

def checksum( String s, Class<? extends Checksum> c ) {
    Checksum cs = c.newInstance();
    cs.update( s.getBytes(), 0, s.size())
    cs.getValue()
}

assert checksum( "194.153.241.7", Adler32.class ) == 
       checksum( "64.229.15.206", Adler32.class )
assert checksum( "maxtnt05-489.phlpa.fast.net", CRC32.class ) == 
       checksum( "bzq-218-115-93.red.bezeqint.net", CRC32.class ) 
assert "adsl-67-64-91-128.dsl.austtx.swbell.net".hashCode() == 
       "h98s18a80n47.user.nortelnetworks.com".hashCode()

// A combination of two?

assert checksum( "/ongoing/pie/0.2/?N=D?N=A?N=A?N=A?D=A?S=A?M=A", Adler32.class ) == 
       checksum( "/ongoing/pie/0.2/?N=D?M=A?S=A?D=A?N=A?N=A?N=A", Adler32.class )
assert           "/ongoing/pie/0.2/?N=D?N=A?N=A?N=A?D=A?S=A?M=A".hashCode() == 
                 "/ongoing/pie/0.2/?N=D?M=A?S=A?D=A?N=A?N=A?N=A".hashCode()

Those functions aren’t supposed to generate unique numbers, of course (that’s what we have strong hash functions for).

Just thought I’d like to publish some of those collisions ..

Categories: Groovy Tags: , , , ,

turn off buzz

February 11, 2010 4 comments

It’s good there’s a “turn off buzz” link at the bottom of my Gmail.

It amazes me how much effort is thrown to make us spend as much time as possible performing pointless and non-productive activities .. Watch TV, commercials, sitcoms, popcorns, browse social networks (Одноклассники!, ВКонтакте!, Facebook!, ЖЖ!), follow everybody and see what they have to say, post comments to their photos, post your own photos, music, video … what a classic examples for Q4 in Covey’s Four Quadrants!

Yeah, sure, part of it is socializing but the way I see it is a waste of time.

May be it’s just me, but I don’t need to socialize that much, really. Friends of mine? I talk to them in person. Others? How many of them have anything valuable to say? Anything worth spending time reading? I mean, I have tons of very smart blogs, articles and books unread (and videos unwatched) to waste my time on this?

My time management is terrible (and I always love my job a little bit too much to leave workplace at normal hours) but I work on improving it and concentrating on things that are important to me. People that are valuable to me. Things that need to be done.

So I turned off all messengers long time ago (I only open Skype or Google Talk to talk to someone). I stopped visiting those stupid social networks long time ago as well. But I loove Twitter – it’s all about news, quick updates and following only those you really want to hear from. And it doesn’t have this annoying “unread” counter (what a piece of brilliance!), pushing one to spend more and more time reading, like, everything – but does one need to?

Buzz? I still don’t get Wave and I don’t get how people find it usable or useful. When it changes – I’ll be glad to join, like it already happened with Zoho. Honestly, there were times when I was laughing at idea to put Word on-line but .. I’m now a big time Zoho user. Well, things change.

So may be one day I’ll “get” what for do I need Wave or Buzz. Till then – turn off buzz and all I want is my Gmail account to load as fast as possible. I appreciate Google’s efforts spent on making Web move faster. But not on making me read more pointless data.

When I leave office in time and get to reading – I have plenty of resources to start from, thank you.

Categories: Google Tags: