in reply to MySQL pack?

In MySQL 4 the length of BIGINT is 64 bit, so I don't think it is possible to store your 357 bit string into a single numeric field by using native SQL-functions.

Also there is no equivalent to the perl pack-function.

But you can split the input into 6 parts and convert each of them to a decimal number (as suggested by Zero_flop) and store it in six fields. That would save your 357 bit string into 48 bytes plus some general overhead.

To retrieve the original data use the CONV(N,from_base,to_base) or BIN(N) function from MySQL and concatenate the results together.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law