Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/CRC-32/AutoHotkey/crc-32-1.ahk
Normal file
9
Task/CRC-32/AutoHotkey/crc-32-1.ahk
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
CRC32(str, enc = "UTF-8")
|
||||
{
|
||||
l := (enc = "CP1200" || enc = "UTF-16") ? 2 : 1, s := (StrPut(str, enc) - 1) * l
|
||||
VarSetCapacity(b, s, 0) && StrPut(str, &b, floor(s / l), enc)
|
||||
CRC32 := DllCall("ntdll.dll\RtlComputeCrc32", "UInt", 0, "Ptr", &b, "UInt", s)
|
||||
return Format("{:#x}", CRC32)
|
||||
}
|
||||
|
||||
MsgBox % CRC32("The quick brown fox jumps over the lazy dog")
|
||||
16
Task/CRC-32/AutoHotkey/crc-32-2.ahk
Normal file
16
Task/CRC-32/AutoHotkey/crc-32-2.ahk
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
CRC32(str)
|
||||
{
|
||||
static table := []
|
||||
loop 256 {
|
||||
crc := A_Index - 1
|
||||
loop 8
|
||||
crc := (crc & 1) ? (crc >> 1) ^ 0xEDB88320 : (crc >> 1)
|
||||
table[A_Index - 1] := crc
|
||||
}
|
||||
crc := ~0
|
||||
loop, parse, str
|
||||
crc := table[(crc & 0xFF) ^ Asc(A_LoopField)] ^ (crc >> 8)
|
||||
return Format("{:#x}", ~crc)
|
||||
}
|
||||
|
||||
MsgBox % CRC32("The quick brown fox jumps over the lazy dog")
|
||||
Loading…
Add table
Add a link
Reference in a new issue