| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
OTP.Commons
Contents
Auxiliary
Since: 3.0.0.0
Since: 3.0.0.0
Since: 3.0.0.0
Constructors
| HMAC_SHA1 | |
| HMAC_SHA256 | |
| HMAC_SHA512 |
Instances
| Show Algorithm Source # | Since: 3.0.0.0 |
| Eq Algorithm Source # | Since: 3.0.0.0 |
| Ord Algorithm Source # | Since: 3.0.0.0 |
| Display Algorithm Source # | Since: 3.0.0.0 |
Defined in OTP.Commons Methods displayBuilder :: Algorithm -> Builder # displayList :: [Algorithm] -> Builder # displayPrec :: Int -> Algorithm -> Builder # | |
mkDigits :: Word32 -> Maybe Digits Source #
RFC 4226 §5.3 says "Implementations MUST extract a 6-digit code at a minimum and possibly 7 and 8-digit code".
This function validates that the number of desired digits is equal or greater than 6.
digitsToWord32 :: Digits -> Word32 Source #
Calculate HOTP counter using time. Starting time (T0 according to RFC6238) is 0 (begining of UNIX epoch) >>> let timestamp = decode "2010-10-10 00:00:30" >>> let timespan = Torsor.scale 30 Chronos.second >>> totpCounter timestamp timespan 42888961
>>>let timestamp2 = decode "2010-10-10 00:00:45">>>totpCounter timestamp2 timespan42888961
>>>let timestamp3 = decode "2010-10-10 00:01:00">>>totpCounter timestamp3 timespan42888962
Since: 3.0.0.0
Arguments
| :: (Word64, Word64) | Number of counters before and after ideal |
| -> Word64 | Ideal counter value |
| -> [Word64] |
Make a sequence of acceptable counters, protected from arithmetic overflow. Maximum range is limited to 1000 due to huge counter ranges being insecure.
>>>counterRange (0, 0) 9000[9000]
>>>counterRange (1, 0) 9000[8999,9000]
>>>length $ counterRange (5000, 0) 9000501
>>>length $ counterRange (5000, 5000) 90001000
>>>counterRange (2, 2) maxBound[18446744073709551613,18446744073709551614,18446744073709551615]
>>>counterRange (2, 2) minBound[0,1,2]
>>>counterRange (2, 2) (maxBound `div` 2)[9223372036854775805,9223372036854775806,9223372036854775807,9223372036854775808,9223372036854775809]
>>>counterRange (5, 5) 9000[8995,8996,8997,8998,8999,9000,9001,9002,9003,9004,9005]
RFC recommends avoiding excessively large values for counter ranges.
Since: 3.0.0.0