diff --git a/README.md b/README.md index 0c76224..db6a0fb 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,18 @@ Also work with less strict rules: gcc *.c -o huffman *main.c is only a test program* + +## bin2blob & blob2bin + +PHP scripts to convert sql blob data (0xAF49...) to binary data and vice versa. + +Both scripts can be replaced by inline php commands: + +* bin2blob: + + php -r 'echo "0x".bin2hex(file_get_contents("php://stdin"));' + +* blob2bin: + + php -r 'echo pack("H*" , preg_replace(array("/^0x/i","/[^0-9A-F]/i"),"",file_get_contents("php://stdin")));' + diff --git a/bin2blob b/bin2blob new file mode 100755 index 0000000..340a3b7 --- /dev/null +++ b/bin2blob @@ -0,0 +1,2 @@ +#!/bin/php + diff --git a/blob2bin b/blob2bin new file mode 100755 index 0000000..897d762 --- /dev/null +++ b/blob2bin @@ -0,0 +1,2 @@ +#!/bin/php +