1
0
mirror of https://github.com/redelmann/scat synced 2025-01-26 14:04:20 +01:00
scat/src/Scat.hs

16 lines
490 B
Haskell

-- | Password scatterer.
module Scat (scatter) where
import Data.Monoid
import Data.ByteString (ByteString, unpack)
import qualified Data.ByteString.Char8 as C
import Crypto.Scrypt
-- | Generates the seed integer given a service, a password and a code.
scatter :: ByteString -> ByteString -> ByteString -> Integer
scatter k pw c = foldr (\ n s -> fromIntegral n + 256 * s) 0 $
unpack $ getHash $ scrypt params (Salt k) (Pass $ pw <> c)
where
Just params = scryptParams 14 8 50