1
0
mirror of https://github.com/redelmann/scat synced 2025-01-27 06:24:21 +01:00
scat/src/Scat.hs

16 lines
490 B
Haskell
Raw Normal View History

2013-08-09 17:19:22 +02:00
-- | Password scatterer.
module Scat (scatter) where
2013-08-09 17:19:22 +02:00
import Data.Monoid
import Data.ByteString (ByteString, unpack)
2013-08-09 17:19:22 +02:00
import qualified Data.ByteString.Char8 as C
2013-08-10 00:13:45 +02:00
import Crypto.Scrypt
2013-08-09 17:19:22 +02:00
-- | 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