SNOBOL4DIGEST(3)

πŸ“¦
version 2.3.1 Β· 3 versions
, in fedora 43, fedora 44, opensuse-leap 16.0

πŸ’– SNOBOL4DIGEST(3) πŸ’–

okay bestie, welcome to the CSNOBOL4 Manual β€” this one's all about digest, the message digest library. cryptographic vibes only, no cap. πŸ”βœ¨


✨ NAME ✨

digest β€” message digest library. that's it, that's the whole thing. hashing, but make it SNOBOL4. πŸ¦‹


🌸 SYNOPSYS 🌸

like, here's the whole shape of it, bestie:

     -INCLUDE 'digest.sno'
          handle = DIGEST_INIT(algorithm)
          DIGEST_UPDATE(handle,string)
          bytes = DIGEST_FINAL(handle)
          string = DIGEST_HEX(bytes)
          bytes = DIGEST(algorithm,string)

(and yes the heading is spelled "SYNOPSYS" in the original, i'm just being faithful, don't come for me 😭)


πŸŽ€ DESCRIPTION πŸŽ€

so the digest module does cryptographic Message Digest calculations. it's giving math but make it mysterious. πŸ’…


🧚 DIGEST_INIT

DIGEST_INIT takes a digest algorithm name β€” like the ones listed by openssl help β€” and hands you back an opaque handle to an object. 🫢

real talk though: not all algorithms are implemented by all versions of the openssl library. so if something's missing, it's not you, it's the library. πŸ™ˆ

and also, lowkey important:

  • Older algorithms have known collision weaknesses. ⚠️
  • Newer algorithms (and longer hash outputs) are slower! 🐌

so like… pick your fighter, bestie. there's a tradeoff and you have to live with it. πŸ’€


πŸ¦‹ DIGEST_UPDATE

DIGEST_UPDATE incorporates the string into the hash. 🫧

and here's the iconic part: calling it multiple times should produce the same result as concatenating all the input strings into one single update call. same energy, different number of calls. periodt. ✨


πŸ’œ DIGEST_FINAL

DIGEST_FINAL returns a string of binary bytes with the hash value β€” and then it deletes the object and handle. so like, that handle is gone gone. don't try to use it again, she's retired. πŸ‘‘


🌈 DIGEST_HEX

DIGEST_HEX takes a string of binary bytes and gives you back a string of lower case hex. lowercase!! not shouting, just vibing. πŸ“


⭐ DIGEST

DIGEST is the one-call wonder: takes an algorithm name and a string to hash, and returns binary bytes. no handle wrangling, just straight to the point. main character energy. πŸ”₯


πŸŽ€ one more thing

if you're actually here for CRC32 and ADLER32 hash algorithms, that's a whole different page β€” go peek at snobol4zlib(3). iykyk. πŸ’«


πŸ‘‘ SEE ALSO πŸ‘‘


πŸ’– AUTHOR πŸ’–

Phil Budne β€” king behavior, we stan. 🫢


okay that's the whole page, bestie!! CSNOBOL4B 2.3.1, dated March 31, 2022 β€” mwah, go hash something responsibly. πŸ’…βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from