Home > Language Reference > Classes > StreamCipher
InitAdler32 Method
Sets the encoding/decoding scheme to Adler32.
Syntax
Public Sub InitAdler32()
Remarks
The InitAdler32 method initializes the stream for Adler32 checksum computation, and allocates the necessary internal buffers. If the object was already initialized, buffers allocated for the previous encoding scheme are freed, and any pending data are lost.
At any time, you can retrieve the current checksum value by reading the Digest property. Calling the Flush method resets the checksum to the default start value.
The following sample shows how to compute the Adler32 checksum over a whole file. Actually, data are simply read into a null stream through a StreamCipher object properly initialized.
Public Function Checksum(ByVal iVolRef As Integer, ByRef sFile As String) As Integer Dim sc As New StreamCipher Dim sn As New StreamNull Dim sf As New StreamFile sf.Open iVolRef,sFile,hbModeOpenExisting+hbModeReadOnly sc.InitAdler32 Set sc.Source=sf sc.Read sn sf.Close Checksum=sc.Digest End Function
Note that in this mode, the StreamCipher object acts as a simple pipe. Read and write operations are simply passed on the underlying Source stream, and data are neither altered nor buffered in any way.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | N/A |