MD5$: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 29: Line 29:
File:Osx.png|'''yes'''
File:Osx.png|'''yes'''
</gallery>
</gallery>
<!-- Additional availability notes go below the gallery -->
<!-- Additional availability notes go below here -->




Line 41: Line 41:
{{Cl|PRINT}}
{{Cl|PRINT}}
{{Text|<nowiki>'this text differs in just 1 bit from the above, by changing 4 to 5</nowiki>|#919191}}
{{Text|<nowiki>'this text differs in just 1 bit from the above, by changing 4 to 5</nowiki>|#919191}}
{{Text|<nowiki>'ASC("4") = 52 = &B00110100</nowiki>|#919191}}
{{Text|<nowiki>'ASC("4") = 52 = &amp;B00110100</nowiki>|#919191}}
{{Text|<nowiki>'ASC("5") = 53 = &B00110101</nowiki>|#919191}}
{{Text|<nowiki>'ASC("5") = 53 = &amp;B00110101</nowiki>|#919191}}
t$ = {{Text|<nowiki>"QB65 Phoenix Edition"</nowiki>|#FFB100}}
t$ = {{Text|<nowiki>"QB65 Phoenix Edition"</nowiki>|#FFB100}}
{{Cl|PRINT}} {{Text|<nowiki>"Mangled Text: "</nowiki>|#FFB100}}; t$
{{Cl|PRINT}} {{Text|<nowiki>"Mangled Text: "</nowiki>|#FFB100}}; t$

Latest revision as of 12:12, 8 December 2024

The _MD5$ function returns the MD5 hash value of any arbitrary string.


Syntax

md5hash$ = _MD5$(dataString$)


Parameters

  • md5hash$ is the hash value returned as hexadecimal STRING, if the given dataString$ was empty the unusual but absolutely correct hash value is:
    • D41D8CD98F00B204E9800998ECF8427E
  • dataString$ is any literal or variable STRING to build the hash value from.


Description

  • MD5 can be used as a checksum to verify data integrity against unintentional corruption.
  • Historically it was widely used as a cryptographic hash function, however it has been found to suffer from extensive vulnerabilities.
  • It remains suitable for other non-cryptographic purposes and may be preferred due to lower computational requirements than more recent Secure Hash Algorithms.


Availability


Examples

Example
Showing how the MD5 hash value can detect differences in two strings.
'this is the correct text
t$ = "QB64 Phoenix Edition"
PRINT "Correct Text: "; t$
PRINT "    MD5 hash: "; _MD5$(t$)
PRINT
'this text differs in just 1 bit from the above, by changing 4 to 5
'ASC("4") = 52 = &B00110100
'ASC("5") = 53 = &B00110101
t$ = "QB65 Phoenix Edition"
PRINT "Mangled Text: "; t$
PRINT "    MD5 hash: "; _MD5$(t$)
END
Example by RhoSigma
Correct Text: QB64 Phoenix Edition
    MD5 hash: E512ECA19E9487D7C2F564E848314238

Mangled Text: QB65 Phoenix Edition
    MD5 hash: 3EF03E7B0DB46F7D1FA6B9626563C10B


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link