SnippetsMD5

Snippets

Base64StringEncoderConstants for numeric limitsDelayMicroSecondsElapsedTimeMD5ModuloRandomFloat

MD5FUNCTION

Descrition

Gives the MD5 fingerprint of the given string.

Syntax

Fingerprint.s = MD5( String.s [, Flags] )

Parameter

String The string for the the fingerprint.
Flags The mode of the string to calculate the fingerprint:
#PB_Ascii All characters have 1 byte.
#PB_Unicode All characters have 2 bytes.
#PB_UTF8 Characters have 1 to 4 bytes.

Return value

The calculated fingerprint as string.

Snippet

Procedure.s MD5(String.s, Flags.i=#PB_UTF8)
  
  Protected Length.i = StringByteLength(String, Flags)
  Protected *Buffer  = AllocateMemory(Length)
  Protected Result.s
  
  PokeS(*Buffer, String, #PB_Default, Flags|#PB_String_NoZero)
  Result = MD5Fingerprint(*Buffer, Length)
  FreeMemory(*Buffer)
  
  ProcedureReturn Result
  
EndProcedure

Example

Debug MD5("Äpfel", #PB_Ascii)
Debug MD5("Äpfel", #PB_UTF8)
Debug MD5("Äpfel", #PB_Unicode)
d1c5faac7b530be151406b478f36bfb1
16114a0b3232bc9a8f978311387e74f2
e0c21dfe8bad592c0bde9f3d3715e5d4
Union Bytes | Login