Help with :crypto.hash

I’m trying to generate a checksum for the first 8 characters of a string using SHA1, in Javascript it would be something like that parseInt(sha1(str).substr(0, 8), 16); for a string “Hi?Hi.” it should be 174888039. Note the character “\x1f” between ? and H.