Copyright | (c) Eric Crockett 2011-2017 Chris Peikert 2011-2017 |
---|---|
License | GPL-2 |
Maintainer | ecrockett0@email.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe |
Language | Haskell2010 |
Utility functions for working with the NIST Randomness Beacon.
- type BeaconEpoch = Int64
- type BeaconOffset = Int32
- bytesPerBeacon :: BeaconOffset
- beaconInterval :: BeaconEpoch
- data BeaconAddr = BA !BeaconEpoch !BeaconOffset
- validBeaconAddr :: BeaconAddr -> Bool
- nextBeaconAddr :: BeaconAddr -> BeaconAddr
- gmtDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> Int
- localDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> IO BeaconEpoch
- beaconFloor :: BeaconEpoch -> BeaconEpoch
Documentation
type BeaconEpoch = Int64 Source #
type BeaconOffset = Int32 Source #
bytesPerBeacon :: BeaconOffset Source #
The number of bytes (512 / 8 = 64
) per beacon.
beaconInterval :: BeaconEpoch Source #
The number of seconds (60
) between beacon outputs.
data BeaconAddr Source #
Represents a byte offset in a beacon output at a particular time.
validBeaconAddr :: BeaconAddr -> Bool Source #
Tests whether a BeaconAddr
is valid or not.
nextBeaconAddr :: BeaconAddr -> BeaconAddr Source #
Advances the beacon position by one byte, overflowing to the next beacon if necessary.
gmtDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> Int Source #
The number of seconds elapsed from a given GMT time since the (GMT) epoch.
localDateToSeconds :: Int -> Int -> Integer -> Int -> Int -> IO BeaconEpoch Source #
The number of seconds elapsed from a given local time since the (GMT) epoch.
beaconFloor :: BeaconEpoch -> BeaconEpoch Source #
Yield the largest beacon epoch that does not exceed the input.