suve

awful: function: sha1

Available since rev.36 (v.0.5.0).

Declaration

ascii :sha1 ( string $MESSAGE , bool $RAW )
ascii :sha1 ( string $MESSAGE )

Summary

Returns a string containing the SHA1 checksum of MESSAGE. If RAW is specified and true, the result will be raw binary data. Otherwise, a hexadecimal representation is returned.

Example

# :sha1 example
:hex-case s'lower'
:set &hash s'2fd4e1c67a2d28fced849ee1bb76e7391b93eb12'
:set &calc :sha1 s'The quick brown fox jumps over the lazy dog'

!if :eq $calc $hash
    :writeln s'SHA1 calculation in awful seems to work fine.'
!else
    :writeln s"lolwut? awful's SHA1 function is broken!"
!fi

wikipage modified on 2014/0601/2317