jb55 on Nostr: in a little endian representation, you can have a packed 4byte string table offset ...
in a little endian representation, you can have a packed 4byte string table offset like so:
The high-order-byte is reserved for a flag. The next 3 bytes enables a 1-2length null terminated string for a,p,e, etc.
The flag could mean packed str, ID offset, string offset. You mask off the HoB when looking in the string table (but if its a packed 1-2 char string then you don’t need to do a lookup).
I then use these “packed string offsets” as tag values. These are 3byte integer offsets into the strings table which is at the end of the tags data.
Published at
2024-05-07 20:31:46Event JSON
{
"id": "13f5e1d73449f4621acdb52081235b9765962f26b1e53f8fa0b6824ad5aa5830",
"pubkey": "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245",
"created_at": 1715106706,
"kind": 1,
"tags": [
[
"e",
"004974ace9553dd603401fe8ae35d3ad0cd4f843a57779ddc58e4d3ce3b5c6b4"
],
[
"e",
"b44dbf3d3688d846a938dad8ded02adb30837269a40817ef1de86678e61b70ff"
],
[
"p",
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322"
],
[
"p",
"266815e0c9210dfa324c6cba3573b14bee49da4209a9456f9484e5106cd408a5"
],
[
"p",
"4c800257a588a82849d049817c2bdaad984b25a45ad9f6dad66e47d3b47e3b2f"
],
[
"p",
"64e024636082e788653ae2b84f49ad161b75a37d75465b6373e7089d2b456c81"
],
[
"p",
"52b4a076bcbbbdc3a1aefa3735816cf74993b1b8db202b01c883c58be7fad8bd"
],
[
"p",
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"
],
[
"r",
"https://cdn.jb55.com/s/53350ae00a718831.png"
]
],
"content": "in a little endian representation, you can have a packed 4byte string table offset like so:\n\nhttps://cdn.jb55.com/s/53350ae00a718831.png\n\nThe high-order-byte is reserved for a flag. The next 3 bytes enables a 1-2length null terminated string for a,p,e, etc.\n\nThe flag could mean packed str, ID offset, string offset. You mask off the HoB when looking in the string table (but if its a packed 1-2 char string then you don’t need to do a lookup).\n\nI then use these “packed string offsets” as tag values. These are 3byte integer offsets into the strings table which is at the end of the tags data.",
"sig": "b415be7e1dbe89984b3b872fed9fc34ccedfbe81a5b78d84232fb2925cc8966d687626358f5613d5ea55ee1f03aaaf733c3368e97f4806481d5f407f325f2682"
}