UDP checksum calculation

The UDP checksum is performed over the entire payload, and the other fields in the header, and some fields from the IP header. A pseudo-header is constructed from the IP header in order to perform the calculation (which is done over this pseudo-header, the UDP header and the payload). The reason the pseudo-header is included … 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

Google Drive MD5 checksum for files

edit: NB these instructions have changed slightly for the v3 API I’ve figured out a quick way to get the MD5 checksums of the files uploaded and decided to share it here, too. Log into your Google Drive account, then: Visit: https://developers.google.com/drive/v3/reference/files/list Scroll down to the Try it! section. Change “Authorize requests using OAuth 2.0” … Read more

File containing its own checksum

I created a piece of code in C, then ran bruteforce for less than 2 minutes and got this wonder: The CRC32 of this string is 4A1C449B Note the must be no characters (end of line, etc) after the sentence. You can check it here: http://www.crc-online.com.ar/index.php?d=The+CRC32+of+this+string+is+4A1C449B&en=Calcular+CRC32 This one is also fun: I killed 56e9dee4 cows … Read more

CRC32 vs CRC32C?

The CRC32 found in zip and a lot of other places uses the polynomial 0x04C11DB7; its reversed form 0xEDB88320 is perhaps better known, being often found in little-endian implementations. CRC32C uses a different polynomial (0x1EDC6F41, reversed 0x82F63B78) but otherwise the computation is the same. The results are different, naturally. This is also known as the … Read more

How do I do a SHA1 File Checksum in C#?

using (FileStream fs = new FileStream(@”C:\file\location”, FileMode.Open)) using (BufferedStream bs = new BufferedStream(fs)) { using (SHA1Managed sha1 = new SHA1Managed()) { byte[] hash = sha1.ComputeHash(bs); StringBuilder formatted = new StringBuilder(2 * hash.Length); foreach (byte b in hash) { formatted.AppendFormat(“{0:X2}”, b); } } } formatted contains the string representation of the SHA-1 hash. Also, by using … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)