pebxcvi's picture
update
ee7329c
Raw
History Blame Contribute Delete
4.43 kB
1.32 Hash .260
1.32.1 Hash.Create .260
1.32.2 Hash.Finalize .261
1.32.3 Hash.Start .261
1.32.4 Hash.Update .262
1.9 Base64 .55
1.9.1 Base64.Decode .55
1.9.2 Base64.DecodeFromString .55
1.9.3 Base64.Encode .56
Hash
Hash.Create
Brief
Creates a new hash object.
Definition
Hash.Create( string type )
Arguments
type - The hash type
Return Values
A new instance of a hash object.
Description
Creates a new hash object. Supported types are "SHA1", "MD5�.
Examples
! myHash = Hash.Create( "SHAl" )
See Also
Hash.Finalize
Brief
Finalize the hash calculation and return the result.
Definition
! Hash.Finalize()
Arguments
None
Return Values
string - The hash result.
Description
Finalize the hash calculation and return the result.
Examples
! local result = myHash.Finalize ()
See Also
Hash.Start
Brief
Prepares a hash object ready for calculating a new hash.
Definition
j Hash.Start ()
Arguments
None
Return Values
None
Description
Prepares a hash object ready for calculating a new hash.
Examples
! myHash.Start()
See Also
Hash.Update
Brief
Updates a hash calculation.
Definition
: Hash.Update( variant data )
Arguments
data - A string, number or MemoryContainer
Return Values
None
Description
Updates a hash calculation. Numbers will be hashed as floats.
Examples
! myHash.Update( "My String" )
See Also
Base64
Base64.Decode
Brief
Decodes the base64 contents of a memory container.
Definition
number Base64.Decode( MemoryContainer out, MemoryContainer in, number offset = -1, number size = -1 )
Arguments
out - The memory container to write the decoded data to.in - The memory container to read the base64 data from.offset - The offset of the data in
the input memory container. Defaults to -1 .size - The size of data to read from the input memory container. Defaults to -1.
Return Values
The number of bytes written to the output memory container or a negative number on error.
-1 - Invalid arg
-2 - Not enough space in the target memory container
Description
Decodes the base64 contents of a memory container. Data is always written to the output container as a stream. If no size or offset are supplied
(or are set to -1), all available data from the input memory container will be encoded. This function will not alter the input memory container in
anyway.
Examples
local output = MemoryContainer.Create( 1024 )
local numBytesDecoded = Base64.Decode( output, input )
See Also
� Base64.Encode
� Base64.DecodeFromString
Base64.DecodeFromString
Brief
Decodes the base64 contents of a string.
Definition
number Base64.DecodeFromString( MemoryContainer out, string in )
Arguments
out - The memory container to write the decoded data to.in - The string containing the base64 data.
Return Values
The number of bytes written to the output memory container or a negative number on error.
-1 - Invalid arg
-2 - Not enough space in the target memory container
Description
Decodes the base64 string and writes the decoded data to the output memory container. Data is always written to the output container as a
stream.
Examples
local output = MemoryContainer.Create( 1024 )
local numBytesDecoded = Base64.DecodeFromString( output, 'QmFzZTY0IHRlc3QgMw==' )
print( MemoryContainer.GetString( output, 0 ) )
See Also
� Base64. Encode
� Base64. Decode
Base64.Encode
Brief
Encodes the contents of a memory container into base64.
Definition
number Base64.Encode( MemoryContainer out, MemoryContainer in, number offset = -1, number size = -1 )
Arguments
out - The memory container to write the encoded data to.in - The memory container to read the original data from.offset - The offset of the data in
the input memory container.size - The size of data to read from the input memory container.
Return Values
The number of bytes written to the output memory container or a negative number on error.
-1 - Invalid arg
-2 - Not enough space in the target memory container
Description
Encodes the contents of a memory container into base64. Data is always written to the output container as a stream. If no size or offset are
supplied (or are set to -1), all available data from the input memory container will be encoded. This function will not alter the input memory
container in anyway.
Examples
local input = MemoryContainer.Create ( 1024 )
local output = MemoryContainer.Create( 1024 )
MemoryContainer.Setstring( input, 0, 'Base64 test 1* )
local numBytesEncoded = Base64.Encode( output, input )
See Also
� Base64.Decode
� Base64.DecodeFromString