Skip to content

Commit f0cb66c

Browse files
committed
Use latest sel
1 parent e372009 commit f0cb66c

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

one-time-password.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ tested-with:
3131

3232
source-repository head
3333
type: git
34-
location: git://github.com/haskell-cryptography/one-time-password.git
34+
location: https://github.com/haskell-cryptography/one-time-password.git
3535

3636
common ghc-options
3737
ghc-options:

src/OTP/HOTP.hs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)