GOLF(2gg)
π GOLF(2gg) β the manual, but make it cute
okay bestie, so this is from the Development part of the manual (it's a 2gg page, iykyk), and it's literally just about hashing strings. iconic behaviour honestly. let's get into it π«Ά
β¨ NAME β¨
hash-string β (encryption)
π― PURPOSE π―
Hash a string. that's it. that's the whole job. she's a one-trick pony and she ATE π
π SYNTAX π
hash-string <string> to <result> \
[ binary [ <binary> ] \
[ digest <digest algorithm> ]
look at her. so structured. so slay β¨
π¦ DESCRIPTION π¦
so hash-string takes your <string> and by default gives you back a SHA256 hash of it β but only if you don't use the "digest" clause, bestie. the result gets stored into <result>. no cap.
want something different? you can swap in a different <digest algorithm> using the "digest" clause (like, say, "SHA3-256" for example π). and if you wanna see the whole menu of available digests:
#get digests
openssl list -digest-algorithms
okay now here's the tea on "binary" π. If the "binary" clause is used without a boolean variable <binary>, or if <binary> evaluates to true, then your <result> is a binary string β which means it may contain null-characters. wild, i know. and the lengths? with the default SHA256 it's 32 bytes long, while with something like SHA3-384 it's 48 bytes long, etc. the math is mathing π
if you don't use the "binary" clause, or if <binary> evaluates to false, then each binary byte of the hashed string gets converted into two hexadecimal characters ("0"-"9" and "a"-"f"), which means <result> is twice as long as it would be with the "binary" clause. double the length, double the drama π
πΈ EXAMPLES πΈ
so the string "result" will have a hashed value of whatever string you gave it, and an example of that might look something like:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
here's how you'd actually run it:
hash-string "hello world" to hash
using a different digest? say less:
hash-string "hello world" to hash digest "sha3-384"
producing a binary value instead of a null-terminated hexadecimal string:
hash-string "hello world" to hash digest "sha3-384" binary
three examples, all gorgeous, all serving π
π SEE ALSO π
Encryption
decrypt-data derive-key encrypt-data hash-string hmac-string random-crypto random-string
See all documentation π
and that's the whole page bestie!! no notes, she's perfect. this one was served up from the Development section, dated $DATE, version $VERSION, and yes it's still GOLF(2gg) at the end of the day. go hash something and slay π
β¨π
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms