0

I'm trying to fake a CAN message, but I'm not able to understand how the 8-bit checksum is calculated. The checksum follows a pattern along with a 4-bit rolling counter. As long as the data of the message is static, the pattern is repeating every 16 messages. The mean value of the checksum of 16 messages is 127.5. That is more or less what I have been able to figure out.

Can you make any sense of it / see how the checksum is calculated?

Here is the data:

00  00  47
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
51  8b  97
51  8c  6e
51  8d  22
51  8e  f6
51  8f  ba
51  80  19
51  81  55
51  82  81
51  83  cd
51  84  34
51  85  78
51  86  ac
51  87  e0
51  88  43
51  89  0f
51  8a  db
71  8b  10
71  8c  e9
71  8d  a5
71  8e  71
71  8f  3d
71  80  9e
71  81  d2
71  82  06
71  83  4a
71  84  b3
71  85  ff
71  86  2b
71  87  67
71  88  c4
71  89  88
71  8a  5c
71  8b  10
71  8c  e9
71  8d  a5
71  8e  71
71  8f  3d
71  80  9e
71  81  d2
71  82  06
71  83  4a
71  84  b3
71  85  ff
71  86  2b
71  87  67
71  88  c4
71  89  88
71  8a  5c
71  8b  10
71  8c  e9
71  8d  a5
71  8e  71
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
1b  80  d8
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
15  85  1f
15  86  cb
15  87  87
15  88  24
15  89  68
15  8a  bc
15  8b  f0
15  8c  09
15  8d  45
15  8e  91
15  8f  dd
15  80  7e
15  81  32
15  82  e6
15  83  aa
15  84  53
1b  85  b9
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26
13  8a  f2
13  8b  be
13  8c  47
13  8d  0b
13  8e  df
13  8f  93
13  80  30
13  81  7c
13  82  a8
13  83  e4
13  84  1d
13  85  51
13  86  85
13  87  c9
13  88  6a
13  89  26

2 Answers 2

1

That's not a typical checksum at all. You can tell by it's great distance between 1bit changes. It's a CRC. And unless it's a special polynomial you aren't providing all of the data per message (I checked some common polynomials and none matched).

So either you're omitting data and it's a standard poly, or you're going to have a write a 8bit and 16bit CRC and try all polynomials, see if you get any hits.

As to the mean being 128 or so... I'd start looking at 8bit CRC and trying polynomials out to 16bits. You'll get a hit soon, but fwiw, I'd check the inverse of the results in case someone thought they were being cute.

Also see SAEJ1850 vs SAEJ1850"ZERO" for changing the IV before starting the CRC.

2
  • Thank you, I thought that a CRC had to depend on old data (previous messages), and I could see that this was only depending on data inside the message.
    – bjn
    Oct 25, 2017 at 14:41
  • Then I might have came across the solution while trying some of the common automotive CRC's, because I believe one of them gave me 0x47 with 0x00 0x00 as input. Then I continued with 0x00 0x00 0x51 0x81 as input for next message, and the result was wrong. So I thought I was on the wrong track... I guess I should have simply used 0x51 and 0x81 for input to the next message. Now I don't remember which one I used. I also played with adding 0x02 0x90 to the data (CAN id). Can't remember now what I did.
    – bjn
    Oct 25, 2017 at 14:59
1

It looks like this is a custom CRC in which the initial value of the algorithm depends on the first byte of the message.

These parameters stay consistent for all messages:

  • Polynomial = 0x1d
  • Input Reflected = False
  • Result Reflected = False
  • Final Xor Value = 0x00

But the initial value depends on the first byte:

  • 0x00: init = 0x7a
  • 0x51: init = 0x3a
  • 0x71: init = 0xe0
  • 0x13: init = 0xbd
  • 0x15: init = 0xcf
  • 0x1b: init = 0x05

You also have to replace the last byte with 0x00.

For example, using the second message:

518155

Replace the last byte with 0x00:

518100

Using an online calculator and the parameters from above:

Screenshot of online calculator with calculation

I have also tried finding some sort of relationship between the first byte and the initial value used in the algo, but didn't come up with anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.