GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’… GOLF(2gg) β€” the decode-hex page, bestie edition πŸŽ€

okay so we're in the 2gg manual, and today's main character is decode-hex. it's giving hex-decoding. it's giving glow-up from ugly hex string to actual binary. let's go πŸ¦‹


✨ NAME ✨

decode-hex β€” the hex-decoding one (hex-encoding, but make it reverse) πŸ’–


🎯 PURPOSE 🎯

take a hexadecimal string and turn it into data. that's it. that's the whole job. no cap. ✨


πŸ“œ SYNTAX πŸ“œ

decode-hex <data> to <output> \
    [ input-length <input length> ]

πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie: decode-hex decodes a hexadecimal string β€” that's <data> β€” into the string <output>, which you hand over in the to clause. lowkey iconic behaviour. 🫢

now, the rules for <data>, and listen up because this is the part people mess up:

  • <data> must be an even number of digits 0-9 and letters A-F or a-f. like, even. an EVEN number. if you roll up with an odd count it's not gonna slay. πŸ’€
  • the length of <data> can be given by the <input length> number in the input-length clause. you don't have to pass it though β€” if you don't, the length is assumed to be the string length of <data>. periodt. πŸ‘‘

🌸 EXAMPLES 🌸

say you wanna get the original binary data back from a hexadecimal string called "hexdata". the output string "binout" gets created. watch this:

set-string hexdata = "0041000F414200"
decode-hex hexdata to binout

and the value of "binout"? it'll be binary data equal to this C literal right here:

"\x00""A""\x00""\xF""AB""\x00""\x04"

literally so satisfying when it works out like that πŸ˜­πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

  • Hex encoding 🧚
  • decode-hex
  • encode-hex
  • See all documentation 🌈

that's the whole page, babe. $DATE, version $VERSION β€” stay hexed, stay hydrated, and go decode something gorgeous. mwah πŸ’‹πŸ’œ

πŸ“¦ where this page comes from