def digest(self, alg='<STR_LIT>', b64=True, strip=True):
import base64, hashlib<EOL>h = hashlib.new(alg)<EOL>h.update(str(self).encode('<STR_LIT:utf-8>'))<EOL>if b64 == True:<EOL><INDENT>b = base64.urlsafe_b64encode(h.digest()).decode('<STR_LIT:ascii>')<EOL>if strip == True:<EOL><INDENT>b = b.rstrip('<STR_LIT:=>')<EOL><DEDENT>return b<EOL><DEDENT>else:<EOL><INDENT>return h.hexdigest()<EOL><DEDENT>
return a url-safe hash of the string, optionally (and by default) base64-encoded
            alg='sha256'    = the hash algorithm, must be in hashlib
            b64=True        = whether to base64-encode the output
            strip=True      = whether to strip trailing '=' from the base64 output
        Using the default arguments returns a url-safe base64-encoded SHA-256 hash of the string.
        Length of the digest with different algorithms, using b64=True and strip=True:
            * SHA224 = 38 
            * SHA256 = 43 (DEFAULT)
            * SHA384 = 64
            * SHA512 = 86