207
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
Dim
s, hash
As
String
'simple calculation on a short string
s="Sting to calculate SHA1 on"
hash=sha1(s,"",SHA1_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=sha1(s,hash,SHA1_UPDATE,0)
s=romfile.getdata(192)
Wend
hash=sha1(s,hash,SHA1_FINISH,romfile.size)
'last portion for whatever
unprocessed data is remaining in the file
Str Function
Function:
Converts unsigned 16-bit numeric value (word) into its
decimal string representation.
Syntax:
str(num as word) as string
See Also:
,
,
,
,
Part
Description
num
Value to be converted to string.
Details
Can be invoked implicitly, through the string_var= word_var expression (see
example below). Compiler is smart enough to pre-calculate constant-only
expressions involving implicit use of str function.
Examples
dim
w
as
word
dim
s
as
string
w=3400
s = str(w)
'explicit invocation.
s = w
'implicit invocation
s = 100
'will be calculated at compilation -- no actual str function
invokation will be here
Strgen Function
Function:
Generates a string of len length consisting of repeating
substrings substr.
Syntax:
strgen(len as byte,byref substr as string) as string
199
208
200
190
197
195
199
210
200