[Sunshine's Guestbook]

so far 10652 visitors

Add Entry

Alan Cannon  
Tuesday, 2018-03-13 at 04:38

I think i have it.
private void button1_Click(object sender, EventArgs e)
ushort ResultCrc;
string value = tbGTIN.Text;
char[] b = new char[value.Length];
b = value.ToCharArray();
byte [] GtinBytes = new byte[value.Length];

System.Collections.IEnumerable collection = Enumerable.Range(100, 10);

foreach (var ch in b.OfType<object>().Select((x, i) => new { x, i }))
byte _GtinBytes = Convert.ToByte(ch.x);
GtinBytes[ch.i] = _GtinBytes;


catch (OverflowException)
Console.WriteLine("Unable to convert u+{0} to a byte.",


Crc16Model getVPCModel = new Crc16Model(0x8005, 0x0, 0x0, true, true);
Crc16 getVPCDB = new Crc16(getVPCModel);
ResultCrc = getVPCDB.Compute(GtinBytes);
tbCrcResults.Text = ResultCrc.ToString();


Alan Cannon  
Monday, 2018-03-12 at 14:07

i will start with Thank you for sharing source code, it has been nice to find this site and read.
I am trying to implement this code into a .net wrapper, but before i do i was trying to implement a section of code to make sure i understand the calling tree.
So i used the web site for Calculation CRC
Starting with:
String value: 00098765432174180141180310
This results in the proper [ 0x24B5 ] value.

However when i v=created a library from the source code and tried to implement now i am lost in interpreting how to call the methods provided. i have added the following to the source provided in my attempt to recreate what the afore mentioned configuration should be as:
private static ushort GetGtin()
ushort ResultCrc;
string value = "00098765432174180141180310";
byte[] a = new byte[value.Length];
char[] b = new char[value.Length];
b = value.ToCharArray();
for (int i = 0; i < value.Length; i+=2)
a = byte.Parse(b.ToString());
byte[] GtinBytes = new byte[value.Length];
GtinBytes = a;

Crc16Reflected getVPCDB = new Crc16Reflected(Crc16Database.CRC16_ARC);
ResultCrc = getVPCDB.Compute(GtinBytes);
return ResultCrc;


Thank you for any help you can send my way in understanding this implementation.
Best regards,
Alan Cannon

Saturday, 2018-02-17 at 21:49

Thank you so much for you CRC explanation -
I have struggled for years with so many variants - you explanation and detailed step by step were invaluable. You have been bookmarked.

Friday, 2017-11-17 at 03:23

You created a great website. Very useful resources for many of us.

Just one thing, I wonder if CRC8-MAXIM has typo at the Poly (0x31) line.

The calculated result seems to agree with the published reversed poly 0x8C.

Could you please double check?

Monday, 2017-09-11 at 04:05

Hi Bastian,

your site is great!

I head some difficulties to derive the crc32 checksum from ogg pages under Go. I just pulled the crc32 table (poly 0x4C11DB7 / init. val == fin. xor == 0x0) from your generator and passed the page to the function below. Evtl. that solution could undergo an optimization, but I'm very happy with the result right now.

Thank you,


func OggCRC(page []byte) uint32 {
var crc uint32

a, b, c, d := page[22], page[23], page[24], page[25]
page[22], page[23], page[24], page[25] = 0, 0, 0, 0

for _, v := range page {
crc = crc32Table[byte(crc>>24)^v] ^ (crc << 8)

page[22], page[23], page[24], page[25] = a, b, c, d

// flip bytes
return (crc&0x000000ff)<<24 + (crc&0x0000ff00)<<8 + (crc&0x00ff0000)>>8 + (crc&0xff000000)>>24

Wednesday, 2017-04-26 at 14:32

Hi! I can't choose any other CRC32 aglorithm from dropdown. Only basic CRC32 is available. Could you fix this? :)

Sunday, 2017-03-19 at 05:18

Your online crc calculator is very very helpful! Thanks for creating this website. It saved me a lot of time.

Thursday, 2017-03-09 at 09:22

Your CRC calcuator is the most complete one if found! Great job, it helped me a lot. Thank you.

Paul Shapshak, PhD  
Saturday, 2017-01-28 at 17:59

Many thanks for your article on basic rotations derivation.

Thursday, 2016-09-08 at 20:42

Instead of looking at .e.g. Amazon or the author's website I was curious if part 6 of 'Algorithms in C' was published yet (it's been years) (I seem to recall this was planned but without looking at the books I don't know for certain and is besides the point) - and came across your website.

I'm familiar with parsing mathematical expressions (and other types) but I still took a look at your article http://www.sunshine2k.de/coding/jav a/SimpleParser/SimpleParser.html

(although C is my favourite language it is easy to translate Java to C)

I admit I'm barely able to keep my eyes open but I could swear something is wrong (but this means maybe I'm ignoring the obvious) in the 'evaluateIntern' function (okay, 'method'): you check for '+' and evaluate - and you check for '-' and evaluate '+'.

But it's a good article anyway (though admittedly I did not read it in full what I read is good).


[1] [2] [3] [4] [5]

Entries 1 to 10 of 44