Implementing Luhn algorithm using C#

Here are some extension methods that compute a Luhn checkdigit, validate a number with a checkdigit, and add a checkdigit to a number. Tested in .NET 4.5. There are extension methods for strings, ints, int64s and IList. I got some ideas for this from rosettacode.org using System; using System.Collections.Generic; using System.Globalization; using System.Linq; public static … Read more

Determine whether .NET assemblies were built from the same source

It’s not too painful to use command-line tools to filter out MVID and date-time stamps from a text representation of the IL. Suppose file1.exe and file2.exe are built from the same sources: c:\temp> ildasm /all /text file1.exe | find /v “Time-date stamp:” | find /v “MVID” > file1.txt c:\temp> ildasm /all /text file2.exe | find … Read more

Hash Code and Checksum – what’s the difference?

I would say that a checksum is necessarily a hashcode. However, not all hashcodes make good checksums. A checksum has a special purpose — it verifies or checks the integrity of data (some can go beyond that by allowing for error-correction). “Good” checksums are easy to compute, and can detect many types of data corruptions … Read more

JavaScript CRC32

Update I added a helper function to create the CRCTable instead of having this enormous literal in the code. It could also be used to create the table once and save it in an object or variable and have the crc32 function use that (or as W3C’s example, check for the existence and create if … Read more