CRC-32: Difference between revisions
Content added Content deleted
(→{{header|C++}}: Ranges and constexpr) |
(→{{header|PARI/GP}}: append Free Pascal . CRC is the unit to use. ala https://forum.lazarus.freepascal.org/index.php/topic,36396.msg242520.html) |
||
Line 1,803: | Line 1,803: | ||
printf("%0x\n", crc32(0, s, #s)) |
printf("%0x\n", crc32(0, s, #s)) |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Output: |
Output: |
||
<pre>414fa339</pre> |
<pre>414fa339</pre> |
||
=={{header|Pascal}}== |
|||
==={{header|Free Pascal}}=== |
|||
<syntaxhighlight lang=pascal> |
|||
Program CheckCRC; |
|||
{$IFDEF fpc}{$mode Delphi}{$ENDIF} |
|||
{$IFDEF WINDOWS}{$APPTYPE CONSOLE}{$ENDIF} |
|||
uses |
|||
sysutils,crc; |
|||
function CrcString(const mystring: string) : longword; |
|||
var |
|||
crcvalue: longword; |
|||
begin |
|||
crcvalue := crc32(0,nil,0); |
|||
result := crc32(crcvalue, @mystring[1], length(mystring)); |
|||
end; |
|||
var |
|||
mytext: string; |
|||
begin |
|||
myText := 'The quick brown fox jumps over the lazy dog'; |
|||
writeln('crc32 = ', IntToHex(CrcString(mytext), 8)); |
|||
end.</syntaxhighlight> |
|||
Output: |
|||
<pre>crc32 = 414FA339</pre> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |