202
Platforms
©2000-2008 Tibbo Technology Inc.
md5_mode
0- MD5_UPDATE : Set this mode for all data portions
except the last one.
1- MD5_FINISH: Set this mode for the last data portion;
also use this selection if you only have a single data
portion.
total_len
Total length of processed data (in all data portions
combined). Only relevant when md5_mode= 1-
MD5_FINISH. That is, only relevant for the last or a single
data portion.
Details
MD5 is a standard method of calculating hash codes on data of any size. The
amount of input data can often exceed maximum capacity of string variables (255
characters). The md5 method can be invoked repeatedly in order to process the
data of any size (see the example below).
Examples
Dim
s, hash
As
String
'simple calculation on a short string
s="Sting to calculate MD5 on"
hash=md5(s,"",MD5_FINISH,
Len
(s))
'calculation on the entire contents of data in the 'text.txt 'file
romfile.open("text.txt")
hash=""
s=romfile.getdata(192)
'use max portions
While
Len
(s)=192
hash=md5(s,hash,MD5_UPDATE,0)
s=romfile.getdata(192)
Wend
hash=md5(s,hash,MD5_FINISH,romfile.size)
'last portion for whatever
unprocessed data is remaining in the file
Mid Function
Function:
Returns len characters from a string sourcestr starting
from position pos.
Syntax:
mid(byref sourcestr as string, frompos as byte, len as
byte) as string
See Also:
,
Part
Description
sourcestr
String from which to take the middle section.
frompos
First character to take. The leftmost character is counted to
be at position 1.
len
Number of characters to take.
198
205