Posts Tagged ‘code’

Presidential Code Cracked

Sunday, July 5th, 2009

The Wall Street Journal is running a very interesting article on how after 200 years or so a coded message in a letter from Thomas Jefferson’s correspondence has been deciphered.

The message was sent to Jefferson by his friend Robert Patterson, a mathematical professor at the University of Pennsylvania and one of Jeffersons friends he corresponded with quite frequently.

Read more here.

FNV-Hash

Saturday, March 7th, 2009

Recently I needed a fast an reliable hash function with good statistics on distribution and I came across what is commonly known as the FNV-hash function. FNV is short for Fowler / Noll / Vo the last names of the three most prominent people contributing to the hashing function.

Basically the FNV algorithm is a very simple one but it is effective and yields astonishingly well differentiated hashes. It has been used in many different codes and both the algoritm itself and a standard source coude has been released into the public domain.

Pseudo code

hash = offset_basis
for each octet_of_data to be hashed
	hash = hash * FNV_prime
	hash = hash xor octet_of_data
return has

The above is called the FNV-1 algorithm. If the multiplication and the XOR change place we get a variant called the FNV-1a which is very similar in all aspects of the first one. I decided to implement both and hash both as 32 bit numbers and then put them together into one 64 bit number creating a very fast and even spread of hashed numbers.

Prime and offsets

32 bit
Prime: 16777619 offset: 2166136261
64 bit
Prime: 1099511628211 offset: 14695981039346656037

Here is a page on FNV that is a good source of information.

Nikkor Lens Designations

Saturday, July 26th, 2008

Confusing?

There is a lot of confusion among people on the net who recently bought a Nikon digital camera. So I was trying to clear up this concept once and for all. Please link to this site if you run a mailing list or similar where this question comes up now and then.

Nikkor is the brand of lenses produced by Nikon corporations. A lot of people refer to them simply as Nikon brand lenses or Nikon lenses. Don’t get confused, the trading name these lenses are sold under are Nikkor. (more…)