Skip to content

Instantly share code, notes, and snippets.

@sean3z
Created December 29, 2022 23:30
Show Gist options
  • Save sean3z/db12a6b6406412dd441d8f3dfe3c49f2 to your computer and use it in GitHub Desktop.
Save sean3z/db12a6b6406412dd441d8f3dfe3c49f2 to your computer and use it in GitHub Desktop.
WOL Apgar routine in mIRC Script (Frank Razenberg)
alias apgar {
var %lookup = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
var %out, %i = 1
while (%i <= 8) {
var %left, %right = 0
if (%i <= $len($1-)) { %left = $asc($mid($1-, %i ,1)) }
if ($calc($len($1-) - %i + 1) < $len($1-)) { %right = $asc($mid($1-, $calc($len($1-) - %i + 2), 1)) }
var %x = $iif(%left & 1, $and($calc(%left * (2 ^ $and(%left, 1))), %right), $xor(%left, %right))
;# echo -a left: %left - righT: %right - x: %x
%out = %out $+ $mid(%lookup, $calc($and(%x, 63) + 1), 1)
inc %i
}
return %out
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment