Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Adler32MemoryMBS(adler as UInt32, buf as memoryblock, offset as Integer, length as Integer) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Encryption and Hash MBS Compression Plugin 5.4 Yes Yes Yes Yes No
Function: The adler32 hash function from the zlib library.
Notes:
Offset and length must be correct for your memoryblock or you will crash your application!

Update a running Adler-32 checksum with the bytes and return the updated checksum. If buf is nil, this function returns the required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster.

Feedback, Comments & Corrections

Adler32StringMBS(adler as UInt32, buf as string) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Encryption and Hash MBS Compression Plugin 5.4 Yes Yes Yes Yes No
Function: The adler32 hash function from the zlib library.
Example:
dim b as binarystream // some stream
dim adler as Integer
dim data as string
dim originalAdler as Integer = 12345

adler=Adler32MemoryMBS(0,nil,0,0)

data=b.read(10000)
while data<>""
adler=Adler32StringMBS(adler, data)
data=b.read(10000)
wend

if adler <> originalAdler then msgbox "Error in checksum!"
Notes:
Update a running Adler-32 checksum with the bytes and return the updated checksum. If buf is nil, this function returns the required initial value for the checksum.
An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster.

Feedback, Comments & Corrections

CRC32MemoryMBS(crc as UInt32, buf as memoryblock, offset as Integer, length as Integer) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Encryption and Hash MBS Compression Plugin 5.4 Yes Yes Yes Yes No
Function: The crc32 hash function from the zlib library.
Notes:
Offset and length must be correct for your memoryblock or you will crash your application!

Update a running crc with the bytes and return the updated crc. If buf is nil, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application.

Feedback, Comments & Corrections

CRC32StringMBS(crc as UInt32, buf as string) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Encryption and Hash MBS Compression Plugin 5.4 Yes Yes Yes Yes No
Function: The crc32 hash function from the zlib library.
Example:
dim originalCrc as Integer// original CRC
dim crc as Integer // new crc
dim data as string
dim b as binarystream

crc=0

data=b.read(10000)
while data<>""
crc=CRC32StringMBS(crc, data)
data=b.read(10000)
wend

if crc <> originalCrc then msgbox "Error in checksum!"
Notes: Update a running crc with the bytes and return the updated crc. If buf is nil, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application.

Some examples using this method:

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS Compression Plugin.




Links
MBS Xojo tutorial videos