Last active
May 23, 2022 12:21
-
-
Save scharfie/396f7852f33d527d7faeac4c2eba678f to your computer and use it in GitHub Desktop.
packing-test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
php << 'PHP' | |
<?php | |
$f = fopen("packing-test.php.dat", "wb"); | |
$test = pack('A3d', 'Bob', 0); | |
fwrite($f, $test); | |
fclose($f); | |
PHP | |
ruby <<'RUBY' | |
File.open("packing-test.ruby.dat", "wb") do |f| | |
test = ['Bob', 0].pack('A3d') | |
f.write test | |
end | |
RUBY | |
echo "PHP" | |
od -xc packing-test.php.dat | |
echo "RUBY" | |
od -xc packing-test.ruby.dat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment