@@ -101,13 +101,13 @@ hotpSHA256
101101 -- ^ Number of digits in a password. MUST be 6 digits at a minimum, and possibly 7 and 8 digits.
102102 -> OTP
103103 -- ^ HOTP
104- hotpSHA256 key counter digits' = unsafePerformIO $ do
104+ hotpSHA256 key counter digits' =
105105 let digits = digitsToWord32 digits'
106- let msg = runPut $ putWord64be counter
107- hash <- SHA256. authenticationTagToBinary <$> SHA256. authenticate msg key
108- let code = truncateHash $ BS. unpack hash
109- let result = code `rem` (10 ^ digits)
110- pure $ OTP digits result
106+ msg = runPut $ putWord64be counter
107+ hash = SHA256. authenticationTagToBinary $ SHA256. authenticate msg key
108+ code = truncateHash $ BS. unpack hash
109+ result = code `rem` (10 ^ digits)
110+ in OTP digits result
111111
112112-- | Check presented password against a valid range.
113113--
@@ -150,13 +150,13 @@ hotpSHA512
150150 -- ^ Number of digits in a password
151151 -> OTP
152152 -- ^ HOTP
153- hotpSHA512 key counter digits' = unsafePerformIO $ do
153+ hotpSHA512 key counter digits' =
154154 let digits = digitsToWord32 digits'
155- let msg = runPut $ putWord64be counter
156- hash <- SHA512. authenticationTagToBinary <$> SHA512. authenticate msg key
157- let code = truncateHash $ BS. unpack hash
158- let result = code `rem` (10 ^ digits)
159- pure $ OTP digits result
155+ msg = runPut $ putWord64be counter
156+ hash = SHA512. authenticationTagToBinary $ SHA512. authenticate msg key
157+ code = truncateHash $ BS. unpack hash
158+ result = code `rem` (10 ^ digits)
159+ in OTP digits result
160160
161161-- |
162162--
0 commit comments