eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'CRC8Stream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: CRC8Stream


Inheritance:

   Object
   |
   +--Stream
      |
      +--HashStream
         |
         +--CRCStream
            |
            +--CRC8Stream

Package:
stx:libbasic2
Category:
System-Crypt-Hashing
Version:
rev: 1.5 date: 2023/11/29 15:21:59
user: cg
file: CRC8Stream.st directory: libbasic2
module: stx stc-classLibrary: libbasic2

Description:


newSAE_J1850:
  Standard CRC method as defined by SAE J1850 (used in AUTOSAR)
  The polynomial is 0x1D; initial value 0xFF; xorOut is 0xFF
  

[instance variables:]

[class variables:]

copyright

COPYRIGHT (c) 2019 by eXept Software AG All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Class protocol:

instance creation
o  generatorPolynomMSB: anInteger
notice, in literature, the generator polynom is usually specified as an MSB number

o  generatorPolynomMSB: anInteger initValue: initValue
notice, in literature, the generator polynom is usually specified as an MSB number

o  generatorPolynomMSB: anInteger initValue: initValueArg xorOut: xorOut
notice, in literature, the generator polynom is usually specified as an MSB number

o  newSAE_J1850
return an instance of the SAE_J1850 CRC8 (used in AUTOSAR)

o  new_2F
return an instance of the CRC8-2F (used in AUTOSAR).
Currently broken.

queries
o  hashSize
return the size of the hashvalue returned by instances of this class (in bytes)


Instance protocol:

initialization
o  generatorPolynom: anLSBInteger
set the generator polynom for this instance,
set start and xorOut to 16rFF.
Note: you have to set the bit-reversed value, so the LSB must be first

o  generatorPolynom: anLSBInteger initValue: initValueArg
set the generator polynom for this instance.
set start to initValueArg and xorOut to 16rFF.
Note: you have to set the bit-reversed value, so the LSB must be first

o  reset
(comment from inherited method)
reset the current crc value

queries
o  hashValue
return the computed CRC

writing
o  nextPutByte: byte
(comment from inherited method)
add the hash of anObject to the computed hash so far.
aByte can be a SmallInteger <= 255

o  nextPutBytes: count from: anObject startingAt: start
(comment from inherited method)
add the hash of anObject to the computed hash so far.


Examples:


    self assert:(CRC8Stream newSAE_J1850 hashValueOf:#[16rF2 16r01 16r83]) = 16r37. 
    = 55


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 16:39:03 GMT