Salve,

ho cambiato schema su come vorrei che l'hash fosse packato in un unica stringa binaria. Credo che adotterò uno schema tipo questo:
codice:
KEY (3 bytes) $xx $xx $xx
value size (1 byte) $xx
(value text)
Naturalmente il value non potrà essere più lungo di 255 caratteri. All'inizio di tutta questa sequenza vorrei mettere una parola chiave tipo HASH e poi 4 bytes per descrivere la lunghezza di tutte le coppie chiave valore che stanno seguendo.

Questò schema sarebbe una scopiazzata dello schema binario che usa per i tags IDE versione 2 (http://www.id3.org/id3v2-00).

A tal proposito ho trovato e provato ad utilizzare la loro notazione a 4 bytes per codificare la lunghezza di tutta la serie di stringhe:
"The ID3 tag size is encoded with four bytes where the first bit (bit 7) is set to zero in every byte, making a total of 28 bits. The zeroed bits are ignored, so a 257 bytes long tag is represented as $00 00 02 01."

"The reason to use 28 bits (representing up to 256MB) for size description is that we don't want to run out of space here."
Non essendo molto portato in matematica esadecimale ho fatto la cosa più semplice che potevo e nella mi calcolatrice ho convertito: 00 00 02 01 in decimale e mi è venuto: 513 e non 257 come loro dichiarano al contrario per fare 257 in esadecimale sembra che dovrei fare: 00 00 01 01 allora cosa sbaglio??

c'è un modo di usare "pack" per ritornare un numero integer in una forma esadecimale come quella di 4 bytes?? E poi:
"The three character frame identifier is followed by a three byte size descriptor, making a total header size of six bytes in every frame."
anche in questo caso codificano la lunghezza del frame in 3 bytes...come si fa con pack??

grazie mille!!!